一、將數據集轉化成COCO格式數據集python
Kaggle->COCO:git
https://github.com/pascal1129/kaggle_airbus_ship_detection/blob/master/0_rle_to_coco/1_ships_to_coco.pygithub
二、修改匹配的訓練參數文件測試
/xxx/mmdetection/configs/mask_rcnn_r50_fpn_1x.pyspa
40行左右的num_classes值爲實際分類數+1(背景類)
102行左右的data_root值爲數據集的根路徑
train、val、test的ann_file、img_prefix、img_scale
中繼訓練時修改163行的load_from和164行的resume_from爲'/xxx/xxx/epoch_xxx.pth'
三、訓練腳本code
CUDA_VISIBLE_DEVICES=0,1,2,3 python /xxx/mmdetection/tools/train.py config /xxx/mmdetection/configs/mask_rcnn_r50_fpn_1x.py --work_dir ./work_dirs/mask_rcnn_r50_fpn_1x --validate --gpus 3blog
#0,1,2,3是4張顯卡所有可用的意思,具體調用幾張,看最後面的--gpus 3ip
四、測試腳本it
CUDA_VISIBLE_DEVICES=1,2,3 python /xxx/mmdetection/tools/test.py config /xxx/mmdetection/configs/mask_rcnn_r50_fpn_1x.py --checkpoint ./work_dirs/mask_rcnn_r50_fpn_1x/epoch_xxx.pth --out /xxx/workspace/out/maskrcnn.pkl --eval segm --gpus 3io
五、圖像的形式顯示結果
https://github.com/open-mmlab/mmdetection/issues/92#issuecomment-438193334