训练指令:
---------------+
zhangcong@win-SYS-7048GR-TR:~/data/detection/objection-detection$ ./tools/dist_train.sh configs/underwater/cas_r50/cascade_rcnn_r50_fpn_1x.py 2 --validate
~/data/mmdetection$ ./tools/dist_train.sh configs/underwater/cascade_rcnn_r50_fpn_1x.py 2 --validate
validate表示 每次进行验证
报错:
File "/data/zhangcong/mmdetection/mmdet/datasets/custom.py", line 186, in evaluate
raise KeyError('metric {} is not supported'.format(metric))
配置文件中加了:evaluation = dict(interval=1, metric='bbox')
编辑配置文件:
~/data/mmdetection$ vim configs/underwater/cascade_rcnn_r50_fpn_1x.py
实验2:
为了加快速度检测代码,训练和验证都用验证集,所有在log中
map很高,s0.acc和s1.acc高,s2.acc不高
配置文件中的evaluation = dict(interval=1, metric='mAP') 配合指令中 --validate 正常。
改为evaluation = dict(interval=1, metric='bbox')则 报错:
Traceback (most recent call last):
File "./tools/train.py", line 151, in <module>
main()
File "./tools/train.py", line 147, in main
meta=meta)
File "/data/zhangcong/mmdetection/mmdet/apis/train.py", line 165, in train_detector
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 380, in run
epoch_runner(data_loaders[i], **kwargs)
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 288, in train
self.call_hook('after_train_epoch')
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 241, in call_hook
getattr(hook, fn_name)(self)
File "/data/zhangcong/mmdetection/mmdet/core/evaluation/eval_hooks.py", line 76, in after_train_epoch
self.evaluate(runner, results)
File "/data/zhangcong/mmdetection/mmdet/core/evaluation/eval_hooks.py", line 33, in evaluate
results, logger=runner.logger, **self.eval_kwargs)
File "/data/zhangcong/mmdetection/mmdet/datasets/custom.py", line 186, in evaluate
raise KeyError('metric {} is not supported'.format(metric))
KeyError: 'metric bbox is not supported'
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.5/dist-packages/torch/distributed/launch.py", line 235, in <module>
main()
File "/usr/local/lib/python3.5/dist-packages/torch/distributed/launch.py", line 231, in main
cmd=process.args)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-u', './tools/train.py', '--local_rank=0', 'configs/underwater/cascade_rcnn_r50_fpn_1x.py', '--launcher', 'pytorch', '--validate']' returned non-zero exit status 1
实验3:
训练和验证集正常划分训练
dataset中的underwater.py中增加了coco.py里的内容,包括eval, 测试指令:
python3 tools/test.py configs/underwater/cascade_rcnn_r50_fpn_1x.py work_dirs/cascade_rcnn_r50_fpn_1x/cas_r50/epoch_15shiyan3.pth --out ./result/result_epoch_15shiyan3.pkl --eval bbox
通过:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.252
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.444
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.261
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.140
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.248
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.280
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.097
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.282
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.299
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.236
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.299
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.317
5] lr: 0.00500, eta: 7:10:58, time: 0.785, data_time: 0.009, memory: 9044, loss_rpn_bbox: 0.0344, s2.loss_cls: 0.0356, s1.loss_cls: 0.0868, loss_rpn_cls: 0.1759, s0.acc: 94.2129, s0.loss_bbox: 0.0977, s1.loss_bbox: 0.0626, s2.acc: 96.2590, s1.acc: 95.3369, s0.loss_cls: 0.2210, s2.loss_bbox: 0.0238, loss: 0.7379
2020-05-14 03:32:14,742 - mmdet - INFO - Epoch [1][2200/2335] lr: 0.00500, eta: 7:10:21, time: 0.790, data_time: 0.010, memory: 9044, loss_rpn_bbox: 0.0402, s2.loss_cls: 0.0373, s1.loss_cls: 0.0975, loss_rpn_cls: 0.1723, s0.acc: 93.1465, s0.loss_bbox: 0.1315, s1.loss_bbox: 0.0873, s2.acc: 96.0391, s1.acc: 94.4727, s0.loss_cls: 0.2558, s2.loss_bbox: 0.0262, loss: 0.8482
2020-05-14 03:32:52,139 - mmdet - INFO - Epoch [1][2250/2335] lr: 0.00500, eta: 7:09:14, time: 0.748, data_time: 0.009, memory: 9044, loss_rpn_bbox: 0.0318, s2.loss_cls: 0.0323, s1.loss_cls: 0.0785, loss_rpn_cls: 0.1807, s0.acc: 94.9355, s0.loss_bbox: 0.0879, s1.loss_bbox: 0.0654, s2.acc: 96.4941, s1.acc: 95.7637, s0.loss_cls: 0.1947, s2.loss_bbox: 0.0223, loss: 0.6936
2020-05-14 03:33:31,941 - mmdet - INFO - Epoch [1][2300/2335] lr: 0.00500, eta: 7:08:42, time: 0.796, data_time: 0.010, memory: 9044, loss_rpn_bbox: 0.0304, s2.loss_cls: 0.0321, s1.loss_cls: 0.0847, loss_rpn_cls: 0.1587, s0.acc: 94.1387, s0.loss_bbox: 0.1017, s1.loss_bbox: 0.0707, s2.acc: 96.5566, s1.acc: 95.1637, s0.loss_cls: 0.2136, s2.loss_bbox: 0.0227, loss: 0.7147
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 800/800, 6.9 task/s, elapsed: 115s, ETA: 0s
Traceback (most recent call last):
File "./tools/train.py", line 151, in <module>
main()
File "./tools/train.py", line 147, in main
meta=meta)
File "/data/zhangcong/mmdetection/mmdet/apis/train.py", line 165, in train_detector
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 380, in run
epoch_runner(data_loaders[i], **kwargs)
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 288, in train
self.call_hook('after_train_epoch')
File "/usr/local/lib/python3.5/dist-packages/mmcv/runner/runner.py", line 241, in call_hook
getattr(hook, fn_name)(self)
File "/data/zhangcong/mmdetection/mmdet/core/evaluation/eval_hooks.py", line 76, in after_train_epoch
self.evaluate(runner, results)
File "/data/zhangcong/mmdetection/mmdet/core/evaluation/eval_hooks.py", line 33, in evaluate
results, logger=runner.logger, **self.eval_kwargs)
File "/data/zhangcong/mmdetection/mmdet/datasets/underwater.py", line 311, in evaluate
raise KeyError('metric {} is not supported'.format(metric))
KeyError: 'metric mAP is not supported'
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.5/dist-packages/torch/distributed/launch.py", line 235, in <module>
main()
File "/usr/local/lib/python3.5/dist-packages/torch/distributed/launch.py", line 231, in main
cmd=process.args)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-u', './tools/train.py', '--local_rank=0', 'configs/underwater/cascade_rcnn_r50_fpn_1x.py', '--launcher', 'pytorch', '--validate']' returned non-zero exit status 1
python3 tools/test.py configs/underwater/cascade_rcnn_r50_fpn_1x.py work_dirs/cascade_rcnn_r50_fpn_1x/epoch_24.pth --out ./result/result_epoch_24.pkl --eval bbox --show
python3 setup.py develop
sudo python3 setup.py install
python3 ./tools/train.py configs/underwater/cas_r50/cascade_rcnn_r50_fpn_1x.py 2 --validate
zhangcong@win-SYS-7048GR-TR:~/data/detection/objection-detection$ python3 tools/test.py configs/underwater/cas_r50/cascade_rcnn_r50_fpn_1x.py work_dirs/cascade_rcnn_r50_fpn_1x/epoch_2.pth --out ./result/result_epoch_2.pkl --eval bbox
loading annotations into memory...
Done (t=0.03s)
creating index...
index created!
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 800/800, 1.3 task/s, elapsed: 613s, ETA: 0s
writing results to ./result/result_epoch_2.pkl
Starting evaluate bbox
Loading and preparing results...
DONE (t=0.59s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type *bbox*
DONE (t=7.90s).
Accumulating evaluation results...
DONE (t=0.98s).
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.365
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.685
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.341
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.147
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.336
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.409
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.154
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.465
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.559
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.374
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.546
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.580
网友评论