Mmcation2中使用mmdetection中的yolo、faster-rcnn、detr训练VOC数据集

VOC数据集下载:

Pascal VOC Dataset Mirror

环境搭载:

直接使用的mmaction2搭载的环境

代码修改:

待更

终端运行代码:

detr:

python tools/train.py configs/detr/detr_r50_8x2_150e_coco.py --gpu-id 1 --work-dir xinjia

yolo:

python tools/train.py configs/yolox/yolox_s_8x8_300e_coco.py --gpu-id 1 --work-dir xinjia

python tools/train.py configs/yolo/yolov3_d53_fp16_mstrain-608_273e_coco.py --gpu-id 1 --work-dir xinjia

faster-rcnn:

python tools/train.py configs/pascal_voc/faster_rcnn_r50_fpn_1x_voc0712.py --gpu-id 1 --work-dir xinjia

新代码: 

python tools/train.py configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py --gpu-id 1 --work-dir xinjia

python tools/train.py configs/faster_rcnn/xinjia_faster.py --gpu-id 1 --work-dir xinjia
 

cascade_rcnn:

python tools/train.py configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco.py --gpu-id 1 --work-dir xinjia

新代码;

python tools/train.py configs/cascade_rcnn/xinjia_cas.py --gpu-id 1 --work-dir xinjia

代码修改:

使其拥有presision值

mmdetection输出precision指标(VOC数据集) - 海_纳百川 - 博客园 (cnblogs.com)

MAP值:

(22条消息) mmdetection多类目标训练查看单类准确率(AP)以及使用模型测试看结果(show)_清梦枕星河~的博客-CSDN博客

FPS:

(28条消息) mmdetection计算fps和参数量_追梦小狂魔的博客-CSDN博客

(28条消息) 关于mmdetection、mmrotate如何计算参数量、计算量和速度FPS_mmdetection计算fps_不死不休的天鹏!的博客-CSDN博客

VOC to coco:

mmdetection/tools/dataset_converters/pascal_voc.py
代码:

python tools/dataset_converters/pascal_voc.py  data/quwu  -o data/cocoVOC  --out-format coco

coco:
MMdetection使用自定义的coco格式数据集进行训练及测试 - 知乎 (zhihu.com)

包括:修改的CLASS的地方

判断VOC转COCO是否正确:

python tools/misc/browse_dataset.py configs/test/faster_rcnn_r50_fpn_1x_coco.py

python tools/misc/browse_dataset.py  configs/faster_rcnn/xinjia_faster.py

运行代码:

生成PKL文件:

python tools/test.py configs/yolox/yolox_s_8x8_300e_coco.py  xinjia/wight/latest.pth --out latest1234.pkl

通过PKL文件生成PR曲线(顺便打印Precision Recall):

python tools/analysis_tools/plot_pr_curve.py  configs/yolox/yolox_s_8x8_300e_coco.py latest1234.pkl

FPS:

python tools/analysis_tools/benchmark.py  configs/yolox/yolox_s_8x8_300e_coco.py   xinjia/wight/latest.pth

分布式:

python -m torch.distributed.launch --nproc_per_node=1 --master_port=29500 tools/analysis_tools/benchmark.py  configs/yolox/yolox_s_8x8_300e_coco.py   xinjia/wight/latest.pth  --launcher pytorch

python -m torch.distributed.launch --nproc_per_node=1  tools/analysis_tools/benchmark.py  configs/yolox/yolox_s_8x8_300e_coco.py   xinjia/wight/latest.pth  --launcher pytorch

precision值:

tools/analysis_tools/confusion_matrix.py可以得到混淆矩阵,但在这之前先使用test.py得到pkl文件,根据pkl文件计算混淆矩阵。但还是需要经过一些修改,confusion_matrix.py得到的混淆矩阵中的数值是经过归一化了的,可以在166行改成不进行归一化,分母删掉就行。然后211行打印%去掉,这样输出的混淆矩阵,就可以用来手算各种指标了,TP、FP、TN、FN、F1-Score、Precision、Recall、ACC等都可以根据公式计算。

混淆矩阵:

python tools/analysis_tools/confusion_matrix.py configs/yolox/yolox_s_8x8_300e_coco.py   latest1234.pkl coco_confusion_matrix/

多分类precision的三种计算方法:

多分类模型Accuracy, Precision, Recall和F1-score的超级无敌深入探讨 - 知乎 (zhihu.com)




测试faster_rcnn:

python tools/test.py   configs/cascade_rcnn/xinjia_cas.py  xinjia/epoch_30.pth    --eval mAP


 

 

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值