Oriented R-CNN 试图涨点 目标检测 random rotation

1.背景

目标检测、HRSC2016数据集、复现完了Oriented R-CNN的L1、L2、L3 task,接着打算魔改网络,看看哪些方法能涨点!
2022年5月20日22点29分

2.学习mmdet框架

复现的ORCNN是基于obbdetection框架的,他是基于mmdetection的,要魔改,就要先学会怎么改这个框架。

https://github.com/ming71/OBBDet_Swin/tree/master/configs/obb/oriented_rcnn_swin

https://blog.csdn.net/qq_39542170/article/details/112257609
https://jishuin.proginn.com/p/763bfbd5c547
https://www.pythonheidong.com/blog/article/450750/2cbfc504906ac9613718/
https://blog.csdn.net/a8039974/article/details/121699739
https://zhuanlan.zhihu.com/p/101970735

3. dataset

数据分布:

3.1 L2 TASK Train dataset distribute ↓↓↓↓↓↓

L2 TASK Train dataset distribute ↓↓↓↓↓↓
+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 458 | 7142 | 0.9716 | 0.8493 |
| 02    | 185 | 6462 | 1.0000 | 0.9880 |
| 03    | 745 | 7090 | 0.9987 | 0.9081 |
| 04    | 308 | 6626 | 0.9610 | 0.9052 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.9127 |
+-------+-----+------+--------+--------+

3.2 L2 TASK Test dataset distribute ↓↓↓↓↓↓

L2 TASK Test dataset distribute ↓↓↓↓↓↓
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] 444/444, 10.7 task/s, elapsed: 42s, ETA:     0s
+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 314 | 5140 | 0.8917 | 0.6404 |
| 02    | 110 | 4529 | 1.0000 | 0.9828 |
| 03    | 540 | 5068 | 0.9907 | 0.8885 |
| 04    | 224 | 4765 | 0.9152 | 0.8066 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.8296 |
+-------+-----+------+--------+--------+

3.3 L3 Task Train dataset distribute ↓↓↓↓↓↓


L3 Task Train dataset distribute ↓↓↓↓↓↓
+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 378 | 710  | 1.0000 | 0.9537 |
| 02    | 1   | 0    | 0.0000 | 0.0000 |
| 03    | 34  | 312  | 1.0000 | 0.8602 |
| 04    | 1   | 0    | 0.0000 | 0.0000 |
| 05    | 47  | 103  | 1.0000 | 0.9893 |
| 06    | 19  | 107  | 1.0000 | 0.7642 |
| 07    | 257 | 370  | 1.0000 | 0.9986 |
| 08    | 61  | 135  | 1.0000 | 0.9985 |
| 09    | 125 | 286  | 1.0000 | 0.9692 |
| 10    | 29  | 106  | 1.0000 | 1.0000 |
| 11    | 157 | 258  | 1.0000 | 0.9977 |
| 12    | 0   | 0    | 0.0000 | 0.0000 |
| 13    | 7   | 93   | 1.0000 | 0.8576 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 50  | 127  | 1.0000 | 0.9982 |
| 16    | 99  | 133  | 1.0000 | 1.0000 |
| 17    | 0   | 0    | 0.0000 | 0.0000 |
| 18    | 34  | 54   | 1.0000 | 1.0000 |
| 19    | 46  | 102  | 1.0000 | 0.9962 |
| 20    | 15  | 28   | 1.0000 | 1.0000 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 55  | 70   | 1.0000 | 0.9984 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 8   | 27   | 1.0000 | 0.9192 |
| 25    | 165 | 248  | 0.9939 | 0.9091 |
| 26    | 6   | 62   | 1.0000 | 1.0000 |
| 27    | 44  | 68   | 0.9773 | 0.9026 |
| 28    | 5   | 8    | 1.0000 | 1.0000 |
| 29    | 15  | 76   | 1.0000 | 1.0000 |
| 30    | 25  | 59   | 1.0000 | 1.0000 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 13  | 95   | 1.0000 | 1.0000 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.8889 |
+-------+-----+------+--------+--------+

3.4 L3 Task Test dataset distribute ↓↓↓↓↓↓

可能是r101,0.005,我也不确定了,回头测试一下那个pth看看
测试条件:
lr==0.0025,r101,map==65.10
或许和学习率没有关系
,待会测试lr==0.0025,r50,这个不行,
还需要测lr==0.1,r101,也行,看来学习率就在训练的时候有用,测试的时候不调用。

L3 Task Test dataset distribute ↓↓↓↓↓↓
+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 541  | 0.8435 | 0.6284 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 286  | 0.9091 | 0.1447 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 71   | 1.0000 | 0.8143 |
| 06    | 12  | 80   | 0.9167 | 0.5301 |
| 07    | 158 | 293  | 0.9684 | 0.8962 |
| 08    | 40  | 116  | 0.9250 | 0.8090 |
| 09    | 128 | 267  | 0.9766 | 0.8966 |
| 10    | 22  | 105  | 1.0000 | 0.9803 |
| 11    | 103 | 214  | 0.9806 | 0.9072 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 71   | 1.0000 | 0.5000 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 94   | 1.0000 | 0.9218 |
| 16    | 50  | 87   | 1.0000 | 0.9917 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 49   | 0.8889 | 0.6258 |
| 19    | 39  | 112  | 0.9487 | 0.8279 |
| 20    | 16  | 32   | 1.0000 | 0.9173 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 74   | 0.9200 | 0.7228 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 35   | 1.0000 | 0.0312 |
| 25    | 119 | 216  | 0.9076 | 0.8241 |
| 26    | 4   | 69   | 1.0000 | 0.4421 |
| 27    | 60  | 83   | 0.9667 | 0.8960 |
| 28    | 4   | 7    | 0.7500 | 0.4870 |
| 29    | 10  | 80   | 1.0000 | 0.9587 |
| 30    | 16  | 56   | 0.9375 | 0.8745 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 66   | 1.0000 | 0.9504 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6510 |
+-------+-----+------+--------+--------+

4.swin Oriented R-CNN

看到ming71在github开源的 obbdet_swin项目,他做了DOTA数据集的还有别的,我准备把HRSC2016的做完。
先把文件下载到服务器上:

cd /root
mkdir swinOrientedRcnn
cd swinOrientedRcnn
git clone https://github.com/ming71/OBBDet_Swin
cd OBBDet_Swin

然后开始准备程序文件:

4.1 configs/obb/oriented_rcnn

把swinOrcnn的config文件复制到对应的位置:

cp /root/swinOrientedRcnn/OBBDet_Swin/configs/obb/oriented_rcnn_swin/faster_rcnn_orpn_swin_fpn_1x_dota10.py /root/OBBDetection/configs/obb/oriented_rcnn

4.2 mmdet/models/backbones/init.py


OBBDetection/mmdet/models/backbones/init.py
文件中,加入’SwinTransformer‘。

from .swin import SwinTransformer
__all__ = [
    'RegNet', 'ResNet', 'ResNetV1d', 'ResNeXt', 'SSDVGG', 'HRNet', 'Res2Net',
    'HourglassNet', 'DetectoRS_ResNet', 'DetectoRS_ResNeXt','SwinTransformer'
]

4.3 mmdet/models/backbones/swin.py

把swinOrcnn的modul-backbone-swin.py文件复制到相应位置

cp /root/swinOrientedRcnn/OBBDet_Swin/mmdet/models/backbones/swin.py /root/OBBDetection/mmdet/models/backbones/

4.4 改bug

缺文件:

cp /root/swinOrientedRcnn/OBBDet_Swin/mmdet/models/utils/ckpt_convert.py /root/OBBDetection/mmdet/models/utils/

cp /root/swinOrientedRcnn/OBBDet_Swin/mmdet/models/utils/transformer.py /root/OBBDetection/mmdet/models/utils/

cp /root/swinOrientedRcnn/OBBDet_Swin/mmdet/models/utils/builder.py /root/OBBDetection/mmdet/models/utils/

删掉预训练的语句,注意,最后留下一个右括号和一个逗号

      # init_cfg=dict(type='Pretrained', checkpoint='swin_tiny_patch4_window7_224.pth')
      ),

config里边的train_dic和test_dic里边

train_cfg = dict(
    rpn=dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.7,
            neg_iou_thr=0.3,
            min_pos_iou=0.3,
            match_low_quality=True,
            gpu_assign_thr=200,
            ignore_iof_thr=-1),
        sampler=dict(
            type='RandomSampler',
            num=256,
            pos_fraction=0.5,
            neg_pos_ub=-1,
            add_gt_as_proposals=False),
        allowed_border=0,
        pos_weight=-1,
        debug=False),
    rpn_proposal=dict(
        nms_across_levels=False,
        nms_pre=2000,
        nms_post=2000,
        max_num=2000,
        nms_thr=0.8,
        min_bbox_size=0),
    rcnn=dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.5,
            neg_iou_thr=0.5,
            min_pos_iou=0.5,
            match_low_quality=False,
            ignore_iof_thr=-1,
            iou_calculator=dict(type='OBBOverlaps')),
        sampler=dict(
            type='OBBRandomSampler',
            num=512,
            pos_fraction=0.25,
            neg_pos_ub=-1,
            add_gt_as_proposals=True),
        pos_weight=-1,
        debug=False))
test_cfg = dict(
    rpn=dict(
        nms_across_levels=False,
        nms_pre=2000,
        nms_post=2000,
        max_num=2000,
        nms_thr=0.8,
        min_bbox_size=0),
    rcnn=dict(
        score_thr=0.005, nms=dict(type='obb_nms', iou_thr=0.1), max_per_img=2000))

还是不行,报这个错:

FoundError: [Errno 2] No such file or directory: '/tmp/tmp9tms1rcn/tmpidew67pt.py'
(obbdetection) root@container-60cd118dac-91f4b7d2:~/OBBDetection# python tools/train.py configs/obb/oriented_rcnn/faster_rcnn_orpn_swin_fpn_3x_hrsc.py --work-dir work_dirs
Traceback (most recent call last):
  File "/root/miniconda3/envs/obbdetection/lib/python3.7/site-packages/mmcv/utils/config.py", line 101, in _validate_py_syntax
    ast.parse(content)
  File "/root/miniconda3/envs/obbdetection/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "", line 80
    train_cfg = dict(
            ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/train.py", line 153, in <module>
    main()
  File "tools/train.py", line 64, in main
    cfg = Config.fromfile(args.config)
  File "/root/miniconda3/envs/obbdetection/lib/python3.7/site-packages/mmcv/utils/config.py", line 332, in fromfile
    use_predefined_variables)
  File "/root/miniconda3/envs/obbdetection/lib/python3.7/site-packages/mmcv/utils/config.py", line 205, in _file2dict
    Config._validate_py_syntax(filename)
  File "/root/miniconda3/envs/obbdetection/lib/python3.7/site-packages/mmcv/utils/config.py", line 103, in _validate_py_syntax
    raise SyntaxError('There are syntax errors in config '
SyntaxError: There are syntax errors in config file /root/OBBDetection/configs/obb/oriented_rcnn/faster_rcnn_orpn_swin_fpn_3x_hrsc.py: invalid syntax (<unknown>, line 80)
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7f7604d4aef0>
Traceback (most recent call last):
  File "/root/miniconda3/envs/obbdetection/lib/python3.7/tempfile.py", line 448, in __del__
    self.close()
  File "/root/miniconda3/envs/obbdetection/lib/python3.7/tempfile.py", line 444, in close
    unlink(self.name)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp5luxzbce/tmp2lvn83mu.py'
(obbdetection) root@container-60cd118dac-91f4b7d2:~/OBBDetection# 

sorry,我把pretrain注释的时候把后边的括号和逗号忘记了,上边改了就行。

4.5. train.py

nohup python tools/train.py configs/obb/oriented_rcnn/faster_rcnn_orpn_swin_fpn_3x_hrsc.py --work-dir work_dirs >xxxcbtrain202205221640.log 2>&1 &

吃饭去了 2022年5月22日16点43分

接下来,改改ms,rr
Oriented R-CNN 试图涨点 目标检测 random rotation_第1张图片
没加预训练模型,精度低的离谱,

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 5680 | 0.6391 | 0.2062 |
| 02    | 0   | 1    | 0.0000 | 0.0000 |
| 03    | 22  | 1947 | 0.5909 | 0.0188 |
| 04    | 2   | 3    | 0.0000 | 0.0000 |
| 05    | 35  | 855  | 0.7714 | 0.4642 |
| 06    | 12  | 650  | 0.9167 | 0.5257 |
| 07    | 158 | 2014 | 0.9241 | 0.5835 |
| 08    | 40  | 1469 | 0.8750 | 0.1888 |
| 09    | 128 | 2097 | 0.8281 | 0.3985 |
| 10    | 22  | 900  | 0.9091 | 0.0838 |
| 11    | 103 | 1768 | 0.9223 | 0.4545 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 213  | 1.0000 | 0.1154 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 1783 | 0.9429 | 0.2395 |
| 16    | 50  | 1645 | 0.9000 | 0.5358 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 1144 | 0.9444 | 0.3601 |
| 19    | 39  | 1249 | 0.8718 | 0.2319 |
| 20    | 16  | 553  | 0.7500 | 0.4041 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 2076 | 0.6200 | 0.2112 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 767  | 1.0000 | 0.0021 |
| 25    | 119 | 2026 | 0.7479 | 0.3061 |
| 26    | 4   | 339  | 0.7500 | 0.3937 |
| 27    | 60  | 918  | 0.5000 | 0.2234 |
| 28    | 4   | 179  | 0.7500 | 0.1608 |
| 29    | 10  | 609  | 1.0000 | 0.5333 |
| 30    | 16  | 768  | 0.7500 | 0.2583 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 603  | 1.0000 | 0.7725 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.2842 |
+-------+-----+------+--------+--------+

把这个文件作为恢复文件,再来24轮

–resume-from work_dirs/epoch36.pth

[>>>>>>>>>>>>>>>>>>>>>>>>>>] 444/444, 10.3 task/s, elapsed: 43s, ETA:     0s
+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 5415 | 0.6435 | 0.2245 |
| 02    | 0   | 2    | 0.0000 | 0.0000 |
| 03    | 22  | 1896 | 0.5455 | 0.0249 |
| 04    | 2   | 4    | 0.0000 | 0.0000 |
| 05    | 35  | 779  | 0.7714 | 0.4817 |
| 06    | 12  | 599  | 0.9167 | 0.5350 |
| 07    | 158 | 1898 | 0.9304 | 0.5964 |
| 08    | 40  | 1399 | 0.8750 | 0.1971 |
| 09    | 128 | 1985 | 0.8906 | 0.4183 |
| 10    | 22  | 836  | 0.9545 | 0.0874 |
| 11    | 103 | 1700 | 0.9223 | 0.4762 |
| 12    | 1   | 1    | 0.0000 | 0.0000 |
| 13    | 2   | 205  | 1.0000 | 0.1453 |
| 14    | 0   | 1    | 0.0000 | 0.0000 |
| 15    | 35  | 1692 | 0.9143 | 0.2385 |
| 16    | 50  | 1602 | 0.9000 | 0.5939 |
| 17    | 1   | 1    | 0.0000 | 0.0000 |
| 18    | 18  | 1105 | 0.9444 | 0.3453 |
| 19    | 39  | 1183 | 0.8974 | 0.2565 |
| 20    | 16  | 505  | 0.7500 | 0.3985 |
| 21    | 0   | 1    | 0.0000 | 0.0000 |
| 22    | 50  | 1964 | 0.6200 | 0.2225 |
| 23    | 0   | 1    | 0.0000 | 0.0000 |
| 24    | 1   | 683  | 1.0000 | 0.0016 |
| 25    | 119 | 1955 | 0.7311 | 0.3103 |
| 26    | 4   | 332  | 0.7500 | 0.5579 |
| 27    | 60  | 876  | 0.5333 | 0.1981 |
| 28    | 4   | 156  | 0.7500 | 0.2945 |
| 29    | 10  | 597  | 1.0000 | 0.5625 |
| 30    | 16  | 720  | 0.8750 | 0.2719 |
| 31    | 0   | 1    | 0.0000 | 0.0000 |
| 32    | 10  | 552  | 1.0000 | 0.6940 |
| 33    | 0   | 1    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.3012 |
+-------+-----+------+--------+--------+

一共60epoch了,但是精度还是很低。

把优化器加上:


optimizer = dict(
    _delete_=True,
    type='AdamW',
    lr=0.0001,
    betas=(0.9, 0.999),
    weight_decay=0.05,
    paramwise_cfg=dict(
        custom_keys={
            'absolute_pos_embed': dict(decay_mult=0.),
            'relative_position_bias_table': dict(decay_mult=0.),
            'norm': dict(decay_mult=0.)
        }))
lr_config = dict(warmup_iters=1000, step=[9, 11])
runner = dict(max_epochs=12)

从36epoch接着训练,把参数调成了他带的参数,2000-》5000等等,但是也是不行。

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 6711 | 0.6652 | 0.1842 |
| 02    | 0   | 25   | 0.0000 | 0.0000 |
| 03    | 22  | 1697 | 0.5455 | 0.0234 |
| 04    | 2   | 32   | 0.0000 | 0.0000 |
| 05    | 35  | 790  | 0.7714 | 0.4053 |
| 06    | 12  | 606  | 0.9167 | 0.4450 |
| 07    | 158 | 1874 | 0.9241 | 0.5898 |
| 08    | 40  | 1355 | 0.9000 | 0.2111 |
| 09    | 128 | 1942 | 0.8594 | 0.4153 |
| 10    | 22  | 813  | 0.9545 | 0.0991 |
| 11    | 103 | 1647 | 0.9126 | 0.4454 |
| 12    | 1   | 22   | 0.0000 | 0.0000 |
| 13    | 2   | 213  | 0.5000 | 0.1364 |
| 14    | 0   | 22   | 0.0000 | 0.0000 |
| 15    | 35  | 1617 | 0.9143 | 0.2254 |
| 16    | 50  | 1556 | 0.8800 | 0.5603 |
| 17    | 1   | 20   | 0.0000 | 0.0000 |
| 18    | 18  | 1029 | 0.8889 | 0.3085 |
| 19    | 39  | 1127 | 0.8462 | 0.2931 |
| 20    | 16  | 487  | 0.6250 | 0.3754 |
| 21    | 0   | 20   | 0.0000 | 0.0000 |
| 22    | 50  | 2438 | 0.6200 | 0.2416 |
| 23    | 0   | 21   | 0.0000 | 0.0000 |
| 24    | 1   | 607  | 0.0000 | 0.0000 |
| 25    | 119 | 1908 | 0.7311 | 0.2947 |
| 26    | 4   | 307  | 0.7500 | 0.5615 |
| 27    | 60  | 879  | 0.5167 | 0.2185 |
| 28    | 4   | 181  | 0.7500 | 0.0386 |
| 29    | 10  | 535  | 1.0000 | 0.5152 |
| 30    | 16  | 720  | 0.8125 | 0.2893 |
| 31    | 0   | 21   | 0.0000 | 0.0000 |
| 32    | 10  | 541  | 1.0000 | 0.8336 |
| 33    | 0   | 21   | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.2856 |
+-------+-----+------+--------+--------+

我把参数恢复成他的参数

5. 魔改 multi scale

原来就一个(1300,800)
改的是obb/oriented_rcnn/dataset/hrsc.py里边的,
train_pipeline = [
    dict(
    type='Resize',
    img_scale=[(1333,640), (1333,800),(600,1080),(1200,1000),(416,700)],
    multiscale_mode='value',
    keep_ratio=True),
   
]

就这样居然掉点,调到58%

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 914  | 0.9130 | 0.6042 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 456  | 0.9091 | 0.1060 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 113  | 1.0000 | 0.7033 |
| 06    | 12  | 116  | 1.0000 | 0.5635 |
| 07    | 158 | 421  | 0.9937 | 0.8947 |
| 08    | 40  | 220  | 1.0000 | 0.8106 |
| 09    | 128 | 297  | 0.9844 | 0.8976 |
| 10    | 22  | 165  | 1.0000 | 0.8470 |
| 11    | 103 | 328  | 1.0000 | 0.9467 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 95   | 1.0000 | 0.3262 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 201  | 1.0000 | 0.8794 |
| 16    | 50  | 150  | 1.0000 | 0.9949 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 123  | 0.8889 | 0.4521 |
| 19    | 39  | 215  | 1.0000 | 0.8893 |
| 20    | 16  | 56   | 1.0000 | 0.8810 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 98   | 1.0000 | 0.7285 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 71   | 1.0000 | 0.1000 |
| 25    | 119 | 303  | 0.9076 | 0.7717 |
| 26    | 4   | 37   | 0.7500 | 0.1379 |
| 27    | 60  | 101  | 0.9500 | 0.8629 |
| 28    | 4   | 0    | 0.0000 | 0.0000 |
| 29    | 10  | 115  | 1.0000 | 0.9036 |
| 30    | 16  | 107  | 1.0000 | 0.8152 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 108  | 1.0000 | 0.7414 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.5873 |
+-------+-----+------+--------+--------+

还有随机旋转的,暂时不确定:

保留上边的大尺度,同时增加旋转,增加到60epoch

RandomOBBRotate angles=(0, 90)
提升了一个半点,到60%了

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 995  | 0.8957 | 0.5096 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 431  | 0.9091 | 0.0996 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 137  | 1.0000 | 0.6730 |
| 06    | 12  | 144  | 1.0000 | 0.4007 |
| 07    | 158 | 449  | 0.9937 | 0.8924 |
| 08    | 40  | 236  | 1.0000 | 0.8336 |
| 09    | 128 | 280  | 0.9844 | 0.8918 |
| 10    | 22  | 186  | 1.0000 | 0.8349 |
| 11    | 103 | 363  | 1.0000 | 0.9343 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 114  | 1.0000 | 0.6154 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 226  | 1.0000 | 0.8600 |
| 16    | 50  | 181  | 1.0000 | 0.9917 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 131  | 0.8333 | 0.4067 |
| 19    | 39  | 233  | 1.0000 | 0.8816 |
| 20    | 16  | 66   | 1.0000 | 0.8730 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 120  | 1.0000 | 0.7065 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 93   | 1.0000 | 0.5000 |
| 25    | 119 | 361  | 0.9580 | 0.8309 |
| 26    | 4   | 53   | 0.7500 | 0.1851 |
| 27    | 60  | 142  | 0.9667 | 0.8646 |
| 28    | 4   | 0    | 0.0000 | 0.0000 |
| 29    | 10  | 140  | 1.0000 | 0.9140 |
| 30    | 16  | 143  | 1.0000 | 0.8232 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 118  | 1.0000 | 0.7493 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6027 |
+-------+-----+------+--------+--------+

我想用这个在原来64%的35epoch.pth 的基础上接着来36轮

参数设置如下:

angles=(0, 90)
lr=0.0025

不行,优化器参数不同还不能接着训练来,从头开始吧。

诡异的acc

一开始直接升到了99%
后来一直降到95%,又慢慢上升。

评价

还是掉点了,待会重新训练一遍原始的,看看是不是模型哪里改动了 。

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 977  | 0.9304 | 0.5548 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 398  | 1.0000 | 0.1112 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 103  | 1.0000 | 0.7661 |
| 06    | 12  | 119  | 1.0000 | 0.4192 |
| 07    | 158 | 459  | 0.9937 | 0.8919 |
| 08    | 40  | 185  | 0.9750 | 0.8049 |
| 09    | 128 | 350  | 0.9766 | 0.8824 |
| 10    | 22  | 158  | 1.0000 | 0.8921 |
| 11    | 103 | 339  | 0.9903 | 0.9043 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 95   | 1.0000 | 0.2190 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 199  | 1.0000 | 0.8956 |
| 16    | 50  | 144  | 1.0000 | 0.9917 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 106  | 0.9444 | 0.4046 |
| 19    | 39  | 228  | 1.0000 | 0.8302 |
| 20    | 16  | 74   | 1.0000 | 0.8862 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 117  | 0.9800 | 0.6703 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 40   | 0.0000 | 0.0000 |
| 25    | 119 | 321  | 0.9496 | 0.8332 |
| 26    | 4   | 90   | 0.7500 | 0.2455 |
| 27    | 60  | 95   | 0.9833 | 0.8654 |
| 28    | 4   | 1    | 0.2500 | 0.2727 |
| 29    | 10  | 141  | 1.0000 | 0.9091 |
| 30    | 16  | 119  | 1.0000 | 0.9120 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 99   | 1.0000 | 0.5453 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.5818 |
+-------+-----+------+--------+--------+

把tesepiipline加入多尺度
img_scale=[(1333,640), (1333,800),(600,1080),(1200,1000),(416,700)],

60%

速度比原来慢4倍,只有1.8task/s

| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 1082 | 0.9304 | 0.5948 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 434  | 1.0000 | 0.1125 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 103  | 1.0000 | 0.7725 |
| 06    | 12  | 107  | 1.0000 | 0.6250 |
| 07    | 158 | 506  | 1.0000 | 0.9274 |
| 08    | 40  | 195  | 0.9750 | 0.8161 |
| 09    | 128 | 381  | 0.9922 | 0.8938 |
| 10    | 22  | 145  | 1.0000 | 0.9108 |
| 11    | 103 | 335  | 0.9903 | 0.8992 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 83   | 1.0000 | 0.6465 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 204  | 1.0000 | 0.9033 |
| 16    | 50  | 138  | 1.0000 | 1.0000 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 108  | 0.9444 | 0.5451 |
| 19    | 39  | 219  | 1.0000 | 0.8239 |
| 20    | 16  | 76   | 1.0000 | 0.8712 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 121  | 0.9800 | 0.7035 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 40   | 0.0000 | 0.0000 |
| 25    | 119 | 324  | 0.9832 | 0.8531 |
| 26    | 4   | 59   | 1.0000 | 0.6545 |
| 27    | 60  | 117  | 0.9833 | 0.8992 |
| 28    | 4   | 0    | 0.0000 | 0.0000 |
| 29    | 10  | 139  | 1.0000 | 0.8297 |
| 30    | 16  | 110  | 1.0000 | 0.9521 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 88   | 1.0000 | 0.7156 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6278 |
+-------+-----+------+--------+--------+

5.5 用多尺度测试最初的模型

+-------+-----+------+--------+--------+
| 01    | 230 | 1147 | 0.9391 | 0.6505 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 507  | 0.9545 | 0.1189 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 75   | 1.0000 | 0.8420 |
| 06    | 12  | 79   | 1.0000 | 0.6640 |
| 07    | 158 | 343  | 0.9747 | 0.8768 |
| 08    | 40  | 118  | 0.9250 | 0.7880 |
| 09    | 128 | 401  | 0.9531 | 0.8632 |
| 10    | 22  | 95   | 1.0000 | 0.9848 |
| 11    | 103 | 219  | 0.9903 | 0.8966 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 61   | 1.0000 | 0.4242 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 147  | 1.0000 | 0.9066 |
| 16    | 50  | 115  | 1.0000 | 0.9933 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 66   | 0.8333 | 0.6747 |
| 19    | 39  | 114  | 0.9487 | 0.8154 |
| 20    | 16  | 44   | 1.0000 | 0.9206 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 78   | 0.9200 | 0.7720 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 28   | 1.0000 | 0.0714 |
| 25    | 119 | 218  | 0.8992 | 0.7519 |
| 26    | 4   | 53   | 1.0000 | 0.4805 |
| 27    | 60  | 247  | 0.9667 | 0.9058 |
| 28    | 4   | 3    | 0.2500 | 0.2727 |
| 29    | 10  | 75   | 1.0000 | 0.9587 |
| 30    | 16  | 91   | 0.9375 | 0.8045 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 73   | 1.0000 | 1.0000 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6458 |
+-------+-----+------+--------+--------+

涨回来了,换成
img_scale=[ (1333,800),(2666,1600)],
又掉了c

+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.5488 |
+-------+-----+------+--------+--------+

不看了,看书

6. L3 random rotation

先看看模型现在的精度,配置如下:
OBBDetection/configs/obb/base/schedules/schedule_3x.py

optimizer = dict(type='SGD', lr=0.0025, momentum=0.9,

6.1 faster_rcnn_orpn_r50_fpn_3x_hrsc.py 0.6593

OBBDetection/configs/obb/base/schedules/schedule_3x.py
中设置:学习率 0.0025,1块2080ti

开始测试现在r50的精度,2022年5月23日19点30分,开始游戏

 nohup python tools/train.py configs/obb/oriented_rcnn/faster_rcnn_orpn_r50_fpn_3x_hrsc.py --work-dir work_dirs >xcbTrain202205231929.log 2>&1 &
+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 626  | 0.8391 | 0.6175 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 327  | 0.8182 | 0.1210 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 89   | 0.9714 | 0.7117 |
| 06    | 12  | 101  | 1.0000 | 0.6050 |
| 07    | 158 | 367  | 0.9747 | 0.9008 |
| 08    | 40  | 148  | 0.9750 | 0.8226 |
| 09    | 128 | 285  | 0.9219 | 0.8753 |
| 10    | 22  | 114  | 1.0000 | 0.9439 |
| 11    | 103 | 264  | 1.0000 | 0.9573 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 69   | 1.0000 | 0.8485 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 129  | 1.0000 | 0.9478 |
| 16    | 50  | 105  | 1.0000 | 0.9982 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 66   | 0.8889 | 0.6101 |
| 19    | 39  | 139  | 1.0000 | 0.8776 |
| 20    | 16  | 40   | 0.9375 | 0.8318 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 76   | 0.9400 | 0.7103 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 40   | 1.0000 | 0.0476 |
| 25    | 119 | 273  | 0.9076 | 0.8087 |
| 26    | 4   | 83   | 1.0000 | 0.2749 |
| 27    | 60  | 85   | 0.9000 | 0.8815 |
| 28    | 4   | 28   | 1.0000 | 0.7847 |
| 29    | 10  | 130  | 1.0000 | 0.8973 |
| 30    | 16  | 67   | 1.0000 | 0.8215 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 87   | 1.0000 | 0.9047 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6593 |
+-------+-----+------+--------+--------+

6.2 faster_rcnn_orpn_r50_fpn_3x_hrsc_rr.py

只修改这一处,从obb/base/hrsc.py复制的,记得添加第一行的_base_=

  dict(type='RandomOBBRotate', rotate_after_flip=True,
         angles=(0, 90), vert_rate=0.5),
nohup python tools/train.py configs/obb/oriented_rcnn/faster_rcnn_orpn_r50_fpn_3x_hrsc_rr.py --work-dir work_dirs >xcbTrain202205232107.log 2>&1 &

涨点了,涨点了,大喜,明天有东西写了,开摆!
2022年5月23日22点15分

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 861  | 0.8696 | 0.6061 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 367  | 0.8182 | 0.1889 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 93   | 1.0000 | 0.7846 |
| 06    | 12  | 102  | 1.0000 | 0.5378 |
| 07    | 158 | 401  | 0.9810 | 0.8917 |
| 08    | 40  | 138  | 0.9500 | 0.7859 |
| 09    | 128 | 303  | 0.9609 | 0.8927 |
| 10    | 22  | 132  | 1.0000 | 0.9302 |
| 11    | 103 | 323  | 1.0000 | 0.9652 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 65   | 1.0000 | 1.0000 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 174  | 1.0000 | 0.8853 |
| 16    | 50  | 94   | 1.0000 | 0.9982 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 94   | 0.8333 | 0.5478 |
| 19    | 39  | 148  | 1.0000 | 0.8786 |
| 20    | 16  | 47   | 1.0000 | 0.9385 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 92   | 0.9200 | 0.7121 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 61   | 0.0000 | 0.0000 |
| 25    | 119 | 295  | 0.9412 | 0.8327 |
| 26    | 4   | 59   | 1.0000 | 1.0000 |
| 27    | 60  | 133  | 0.9000 | 0.8255 |
| 28    | 4   | 17   | 0.5000 | 0.3636 |
| 29    | 10  | 110  | 1.0000 | 0.8933 |
| 30    | 16  | 95   | 1.0000 | 0.8077 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 82   | 1.0000 | 0.9485 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6746 |
+-------+-----+------+--------+--------+

6.3 faster_rcnn_orpn_r101_fpn_3x_hrsc.py

学习率 0.005,当时没改
验证 3.4的模型是啥来

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 541  | 0.8435 | 0.6284 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 286  | 0.9091 | 0.1447 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 71   | 1.0000 | 0.8143 |
| 06    | 12  | 80   | 0.9167 | 0.5301 |
| 07    | 158 | 293  | 0.9684 | 0.8962 |
| 08    | 40  | 116  | 0.9250 | 0.8090 |
| 09    | 128 | 267  | 0.9766 | 0.8966 |
| 10    | 22  | 105  | 1.0000 | 0.9803 |
| 11    | 103 | 214  | 0.9806 | 0.9072 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 71   | 1.0000 | 0.5000 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 94   | 1.0000 | 0.9218 |
| 16    | 50  | 87   | 1.0000 | 0.9917 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 49   | 0.8889 | 0.6258 |
| 19    | 39  | 112  | 0.9487 | 0.8279 |
| 20    | 16  | 32   | 1.0000 | 0.9173 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 74   | 0.9200 | 0.7228 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 35   | 1.0000 | 0.0312 |
| 25    | 119 | 216  | 0.9076 | 0.8241 |
| 26    | 4   | 69   | 1.0000 | 0.4421 |
| 27    | 60  | 83   | 0.9667 | 0.8960 |
| 28    | 4   | 7    | 0.7500 | 0.4870 |
| 29    | 10  | 80   | 1.0000 | 0.9587 |
| 30    | 16  | 56   | 0.9375 | 0.8745 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 66   | 1.0000 | 0.9504 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6510 |
+-------+-----+------+--------+--------+

6.4 faster_rcnn_orpn_r101_fpn_3x_hrsc_rr.py

学习率 0.0025,1块2080ti
文件里就这两句

_base_ = './faster_rcnn_orpn_r50_fpn_3x_hrsc_rr.py'

# model
model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101))

2022年5月24日08点56分,吃饭去。

结果符合预期

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 764  | 0.9087 | 0.6385 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 323  | 0.9091 | 0.1840 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 84   | 1.0000 | 0.7654 |
| 06    | 12  | 94   | 1.0000 | 0.4971 |
| 07    | 158 | 351  | 0.9810 | 0.8975 |
| 08    | 40  | 158  | 1.0000 | 0.8050 |
| 09    | 128 | 301  | 0.9922 | 0.9001 |
| 10    | 22  | 142  | 1.0000 | 0.9540 |
| 11    | 103 | 262  | 0.9903 | 0.9091 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 77   | 1.0000 | 1.0000 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 167  | 1.0000 | 0.8729 |
| 16    | 50  | 107  | 1.0000 | 0.9982 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 84   | 0.9444 | 0.6038 |
| 19    | 39  | 147  | 1.0000 | 0.8300 |
| 20    | 16  | 37   | 0.9375 | 0.8652 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 89   | 0.9600 | 0.7031 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 55   | 1.0000 | 0.0196 |
| 25    | 119 | 266  | 0.9664 | 0.8493 |
| 26    | 4   | 82   | 1.0000 | 0.8000 |
| 27    | 60  | 114  | 0.9833 | 0.8911 |
| 28    | 4   | 13   | 0.7500 | 0.6818 |
| 29    | 10  | 101  | 1.0000 | 0.9212 |
| 30    | 16  | 62   | 1.0000 | 0.8961 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 86   | 1.0000 | 0.9262 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6818 |
+-------+-----+------+--------+--------+

6.5 random rotatioin 小结

经过这四个实验,r101+random rotation 效果最好。

7. L2 random rotation

L3 换到 L2 task
修改的地方:

  1. OBBDetection/BboxToolkit/BboxToolkit/datasets/misc.py hrsc_cls
  2. config文件 num_class=4;
  3. OBBDetection/BboxToolkit/BboxToolkit/datasets/HRSCio.py 标签映射到L2 task
  4. configs\obb_base_\datasets\hrsc.py classwise=False,改成True

7.1 faster_rcnn_orpn_r50_fpn_3x_hrsc.py

这个先不测了

7.2 faster_rcnn_orpn_r50_fpn_3x_hrsc_rr.py

这个也不测了

7.3 faster_rcnn_orpn_r101_fpn_3x_hrsc.py

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 314 | 5140 | 0.8917 | 0.6404 |
| 02    | 110 | 4529 | 1.0000 | 0.9828 |
| 03    | 540 | 5068 | 0.9907 | 0.8885 |
| 04    | 224 | 4765 | 0.9152 | 0.8066 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.8296 |
+-------+-----+------+--------+--------+

7.4 faster_rcnn_orpn_r101_fpn_3x_hrsc_rr.py

涨了一点

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 314 | 2950 | 0.9236 | 0.6630 |
| 02    | 110 | 2159 | 1.0000 | 0.9767 |
| 03    | 540 | 2728 | 1.0000 | 0.9113 |
| 04    | 224 | 2429 | 0.9777 | 0.8255 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.8441 |
+-------+-----+------+--------+--------+

模型和信息保存在2938 epoch /L2_task/faster_rcnn_orpn_r101_fpn_3x_hrsc_rr

8. L1 random rotation

8.1 faster_rcnn_orpn_r101_fpn_3x_hrsc.py

这是官方给的:
90.50%

8.2 faster_rcnn_orpn_r101_fpn_3x_hrsc_rr.py

2022年5月24日13点22分
睡觉起来就有了
增加epoch就过拟合了

+-------+------+------+--------+--------+
| class | gts  | dets | recall | ap     |
+-------+------+------+--------+--------+
| ship  | 1188 | 2707 | 0.9907 | 0.9058 |
+-------+------+------+--------+--------+
| mAP   |      |      |        | 0.9058 |
+-------+------+------+--------+--------+

9.Focal loss

9.1 faster_rcnn_orpn_r50_fpn_3x_hrsc_Focal_loss.py

在配置文件中修改

# loss_cls=dict(
#     type='CrossEntropyLoss',
#     use_sigmoid=False,
#     loss_weight=1.0),
loss_cls=dict(
    type='FocalLoss',
    use_sigmoid=True,
    gamma=2.0,
    alpha=0.25,
    loss_weight=1.0),

然后开始训练,interval ==3
使用的9336的账号,
精度下降了,很奇怪

+-------+-----+------+--------+--------+
| class | gts | dets | recall | ap     |
+-------+-----+------+--------+--------+
| 01    | 230 | 641  | 0.8522 | 0.6134 |
| 02    | 0   | 0    | 0.0000 | 0.0000 |
| 03    | 22  | 347  | 0.7273 | 0.1130 |
| 04    | 2   | 0    | 0.0000 | 0.0000 |
| 05    | 35  | 96   | 1.0000 | 0.6815 |
| 06    | 12  | 111  | 1.0000 | 0.5766 |
| 07    | 158 | 356  | 0.9810 | 0.8913 |
| 08    | 40  | 143  | 0.9750 | 0.8256 |
| 09    | 128 | 281  | 0.9531 | 0.8979 |
| 10    | 22  | 131  | 1.0000 | 0.9578 |
| 11    | 103 | 256  | 0.9903 | 0.9072 |
| 12    | 1   | 0    | 0.0000 | 0.0000 |
| 13    | 2   | 81   | 1.0000 | 0.7273 |
| 14    | 0   | 0    | 0.0000 | 0.0000 |
| 15    | 35  | 141  | 0.9714 | 0.8661 |
| 16    | 50  | 102  | 0.9600 | 0.9053 |
| 17    | 1   | 0    | 0.0000 | 0.0000 |
| 18    | 18  | 82   | 1.0000 | 0.4208 |
| 19    | 39  | 147  | 0.9744 | 0.8123 |
| 20    | 16  | 33   | 0.9375 | 0.8750 |
| 21    | 0   | 0    | 0.0000 | 0.0000 |
| 22    | 50  | 77   | 0.9200 | 0.7168 |
| 23    | 0   | 0    | 0.0000 | 0.0000 |
| 24    | 1   | 31   | 1.0000 | 0.0625 |
| 25    | 119 | 256  | 0.9076 | 0.8020 |
| 26    | 4   | 62   | 1.0000 | 0.6545 |
| 27    | 60  | 96   | 0.9500 | 0.8977 |
| 28    | 4   | 14   | 0.7500 | 0.3776 |
| 29    | 10  | 115  | 1.0000 | 0.9212 |
| 30    | 16  | 82   | 1.0000 | 0.7649 |
| 31    | 0   | 0    | 0.0000 | 0.0000 |
| 32    | 10  | 96   | 1.0000 | 0.8379 |
| 33    | 0   | 0    | 0.0000 | 0.0000 |
+-------+-----+------+--------+--------+
| mAP   |     |      |        | 0.6336 |
+-------+-----+------+--------+--------+

查阅了网上的参考资料,交叉熵函数确实适合多分类

10. GIoU

10.faster_rcnn_orpn_r50_fpn_3x_hrsc_GloU_loss.py

显示维度不匹配,一个是3一个是2下午再改。
可能时mmdet的代码不完整,我换用https://blog.csdn.net/weixin_44944382/article/details/123893486这个pytorch的代码

发现自己的 mmdet版本不对,更新mmdet,发现CSDN开始卡顿了,新建一个

你可能感兴趣的:(笔记,目标检测,人工智能,计算机视觉)