其他分享
首页 > 其他分享> > 百度飞浆目标检测

百度飞浆目标检测

作者:互联网

配环境

创建项目时,自动使用PaddlePaddle【自动安装CUDA10.1】和python3.7。
在这里插入图片描述

安装paddledetection(创建项目时,已经安装了paddlepaddle)

#notebook中用!
# 下载PaddleDetection
!git clone https://gitee.com/paddlepaddle/PaddleDetection
# 移到work目录下,持久安装
!mv PaddleDetection work 
#安装paddledetection
python setup.py install
#配置PaddleDetection环境 
!pip install -r /home/aistudio/work/PaddleDetection/requirements.txt
#安装可视化工具VisualDL
python -m pip install visualdl -i https://mirror.baidu.com/pypi/simple

#将数据集解压到指定目录
unzip tile_r2_no_model.zip -d /home/aistudio/work/PaddleDetection/dataset/tile_voc

# 边训练边测试 CPU需要约1小时(use_gpu=false),1080Ti GPU需要约5分钟。
# -c 参数表示指定使用哪个配置文件
# -o 参数表示指定配置文件中的全局变量(覆盖配置文件中的设置),这里设置使用gpu,
# --eval 参数表示边训练边评估,会自动保存一个评估结果最的名为best_model.pdmodel的模型
python tools/train.py -c configs/yolov3_mobilenet_v1_roadsign.yml --eval -o use_gpu=true
#训练时,记录数据
python -u tools/train.py -c configs/yolov3_mobilenet_v1_roadsign.yml \
                        --use_vdl=true \
                        --vdl_log_dir=vdl_dir/scalar \
                        --eval
#通过 visualdl 命令实时查看变化曲线:https://github.com/PaddlePaddle/VisualDL/blob/develop/README_CN.md
visualdl --logdir vdl_dir/scalar/ --host 127.0.0.1 --port 8080

# 评估 默认使用训练过程中保存的best_model
# -c 参数表示指定使用哪个配置文件
# -o 参数表示指定配置文件中的全局变量(覆盖配置文件中的设置),需使用单卡评估
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/yolov3_mobilenet_v1_roadsign.yml -o use_gpu=true

# -c 参数表示指定使用哪个配置文件
# -o 参数表示指定配置文件中的全局变量(覆盖配置文件中的设置)
# --infer_img 参数指定预测图像路径
# 预测结束后会在output文件夹中生成一张画有预测结果的同名图像

python tools/infer.py -c configs/yolov3_mobilenet_v1_roadsign.yml -o use_gpu=true --infer_img=demo/road554.png

# 训练后再评估
# 训练时,不评估,且记录loss
export CUDA_VISIBLE_DEVICES=0
python tools/train.py -c configs/faster_rcnn_r50_1x.yml use_gpu=true

标签:use,配置文件,--,检测,py,python,飞浆,gpu,百度
来源: https://blog.csdn.net/puspos/article/details/121122458