MMdetection COCO test-dev测试步骤总结
1、修改config文件
data = dict(
samples_per_gpu=1,
workers_per_gpu=0,
train=dict(
type=dataset_type,
ann_file=data_root + 'annotations/instances_train2017.json',
img_prefix=data_root + 'train2017/',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
ann_file=data_root + 'annotations/instances_val2017.json',
img_prefix=data_root + 'val2017/',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
ann_file=data_root + 'annotations/image_info_test-dev2017.json',
img_prefix=data_root + 'test2017/',
pipeline=test_pipeline))
2、测试
python tools/test.py configs/retinanet_x101_fpn_2x.py work_dirs/retinanet_x101_fpn_2x/epoch_24.pth --format-only --options "jsonfile_prefix=./retinanet_x101_results"
3、多尺度测试
修改config后继续按步骤2操作:
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='MultiScaleFlipAug',
img_scale=[(800, 480), (1067, 640), (1333, 800), (1600, 960), (1867, 1120), (2133, 1280)],
flip=True,
transforms=[
dict(type='Resize', keep_ratio=True),
dict(type='RandomFlip'),
dict(type='Normalize', **img_norm_cfg),
dict(type='Pad', size_divisor=32),
dict(type='ImageToTensor', keys=['img']),
dict(type='Collect', keys=['img']),
])
]
4、提交
测试后你会得到一个json文件,将其转为zip文件后,在COCO官网注册后进行提交。2019和2017的test-dev数据集未发生变动,所以直接提交即可,大约10-20分钟出结果,有时比较慢,提交不上多提交两遍即可。
我在多尺度测试后能够涨点1.3左右,感觉没有想象中的高,如果您能够获得更高的提升,也希望您能和我分享一下trick或者如何更好地设置,感恩!