dingjiansw101 / AerialDetection

Apache License 2.0
786 stars 183 forks source link

Faster-RCNN-R50-FPN 在TASK2 DOTAV1.0精度对不上 #99

Closed aiboys closed 1 year ago

aiboys commented 2 years ago

Hi, 作者您好。我用该框架的faster_rcnn_r50_fpn_1x_dota.py跑了DOTA V1.0的task2, 除了data文件,其余的配置比如模型、优化器等完全保持不变,没有做任何修改。下面是我的data config:

# train

trainval = []
train = dict(
        type=dataset_type,
        ann_file=data_root + 'official_v10_train1024/train1024_v10.json',
        img_prefix=data_root + 'official_v10_train1024/images/',
        img_scale=(1024, 1024),
        img_norm_cfg=img_norm_cfg,
        size_divisor=32,
        flip_ratio=0.5,
        with_mask=True,
        with_crowd=True,
        with_label=True)
trainval.append(train)
val = dict(
        type=dataset_type,
        ann_file=data_root + 'official_v10_val1024/val1024_v10.json',
        img_prefix=data_root + 'official_v10_val1024/images/',
        img_scale=(1024, 1024),
        img_norm_cfg=img_norm_cfg,
        size_divisor=32,
        flip_ratio=0.5,
        with_mask=True,
        with_crowd=True,
        with_label=True)
trainval.append(val)

data = dict(
    imgs_per_gpu=2,
    workers_per_gpu=2,
    train=dict(
        # type='ConcatDataset',
        # dataset=trainval),
        type=dataset_type,
        ann_file=[data_root + 'official_v10_train1024/train1024_v10.json', data_root + 'official_v10_val1024/val1024_v10.json'],  # train+val训练
        img_prefix=[data_root + 'official_v10_train1024/images/', data_root + 'official_v10_val1024/images/'],
        img_scale=(1024, 1024),
        img_norm_cfg=img_norm_cfg,
        size_divisor=32,
        flip_ratio=0.5,
        with_mask=True,
        with_crowd=True,
        with_label=True),
    val=dict(
        type=dataset_type,
        ann_file=data_root + 'official_v10_val1024/val1024_v10.json',
        img_prefix=data_root + 'val1024/images',
        img_scale=(1024, 1024),
        img_norm_cfg=img_norm_cfg,
        size_divisor=32,
        flip_ratio=0,
        with_mask=False,
        with_crowd=True,
        with_label=True),
    test=dict(
        type=dataset_type,
        ann_file=data_root + 'official_v10_test1024/test1024_v10.json',
        img_prefix=data_root + 'official_v10_test1024/images',
        img_scale=(1024, 1024),
        img_norm_cfg=img_norm_cfg,
        size_divisor=32,
        flip_ratio=0,
        with_mask=False,
        with_label=False,
        test_mode=True))

其中的训练集和验证集,测试集的分割使用DOTA_devikit脚本:

split_train = ImgSplit_multi_process.splitbase(os.path.join(srcpath, 'train'),
                       os.path.join(dstpath, 'train1024'),
                      gap=512,
                      subsize=1024,
                      num_process=128
                      )
    split_train.splitdata(1)

    print('val...')
    split_val = ImgSplit_multi_process.splitbase(os.path.join(srcpath, 'val'),
                       os.path.join(dstpath, 'val1024'),
                      gap=512,
                      subsize=1024,
                      num_process=128
                      )
    split_val.splitdata(1)

我对比了你们新的论文里提到了stride是824不一样以外,其余的完全一致。 在得到小图之后,我后续排除掉了训练集和验证集没有object的图片,训练集一共:19206张,验证集一共6179张,测试集一共20415张。

我测试了四卡,batchsize=8时(2 images per GPU),epoch12的模型结果: 在NMS=0.3(也就是论文里提到的阈值): AP50=68.04 image

在NMS=0.5时: AP50=67.49 image

同时,我也测试了单卡,batchsize=2,NMS=0.5时测试结果: AP50=69.94 image

不管是官方的8batchsize还是2batchsize,精度都对不上论文给的AP50=70.76,我不知道是我数据的问题(但不知道哪里有问题)。 求解答~~~

dingjiansw101 commented 2 years ago

论文中的数据都是用训练+验证集训练,然后在测试集上测试的。 你应该提交你的结果到dota测评服务器上测试。

aiboys commented 2 years ago

论文中的数据都是用训练+验证集训练,然后在测试集上测试的。 你应该提交你的结果到dota测评服务器上测试。

是的,我采用了trainval进行训练,然后对test的数据测试之后打包到DOTA官方网站得到的邮件结果~~~

dingjiansw101 commented 2 years ago

DOTA-v1.0上1个点是正常的误差范围,你可以多跑几次看看