1.安装
python -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple #加速克隆paddledetection git clone https://hub.fastgit.org/PaddlePaddle/PaddleDetection.git #选择使用码云上的托管 git clone https://gitee.com/paddlepaddle/PaddleDetection pip install "git+https://hub.fastgit.org/cocodataset/cocoapi.git#subdirectory=PythonAPI"
2.将自己的数据集转换为coco数据集
python tools/x2coco.py --dataset_type labelme --json_input_dir ./dataset/coco/2json --image_input_dir ./dataset/coco/2jpg --output_dir ./output --train_proportion 0.8 --val_proportion 0.2 --test_proportion 0.0
3.修改配置文件
coco_instance.yml中修改类别数,修改数据集路径
4.训练
#cpu训练 python tools/train.py -c configs/mask_rcnn/mask_rcnn_r50_fpn_2x_coco.yml -o use_gpu=false --eval #gpu训练 python -u tools/train.py -c configs/mask_rcnn_r50_vd_fpn_2x.yml --use_vdl=true --vdl_log_dir=vdl_dir/scalar --eval -o use_gpu=true
训练中出现没有各种包的错误,可以按照如下解决
pip install pyyaml -i https://pypi.douban.com/simple/
pip install opencv-python -i https://pypi.douban.com/simple/
5.测试
python tools/eval.py -c configs/mask_rcnn_r50_fpn_1x.yml -o use_gpu=true weights=output/mask_rcnn_r50_fpn_1x/best_model



