生成相应的json结果文件
1、在安装的环境中运行时
python tools/test.py G:/mmdetection-master/work_dirs/0308/kcp/kcp_gfl.py G:/mmdetection-master/work_dirs/0308/kcp/best_bbox_mAP_epoch_11.pth --format-only --eval-options "jsonfile_prefi
x=G:/mmdetection-master/rsult/0308/kcp/"
2、在本地运行时
需要注意修改以下几点,记得在参数前加上“–”
parser.add_argument('--config', default='G:/mmdetection-master/work_dirs/0308/kcp/kcp_gfl.py', help='test config file path')
parser.add_argument('--checkpoint', default='G:/mmdetection-master/work_dirs/0308/kcp/best_bbox_mAP_epoch_11.pth', help='checkpoint file')
parser.add_argument(
'--format-only',
action='store_true',
default=True, # kcp 0308 这里添加一行启用
help='Format the output results without perform evaluation. It is'
'useful when you want to format the result to a specific format and '
'submit it to the test server')
if args.format_only:
# dataset.format_results(outputs, **kwargs)
dataset.format_results(outputs, jsonfile_prefix='G:/mmdetection-master/results/0308/1/', **kwargs) # 在这里添加保存json的路径!!就可以了