When I run my file, both changing the terminal command and adding a key_val to the evaluate dict are not work well.
Let me show you:
This one came out when I type in this command:python tools/test.py configs/mask_rcnn_semi_auto_germinal_center/config_inference.py work_dirs/mask-rcnn_r50-caffe_fpn_ms-poly-1x_germinal_center/epoch_15.pth
after_run:
(BELOW_NORMAL) LoggerHook
Traceback (most recent call last):
File "tools/test.py", line 149, in
main()
File "tools/test.py", line 139, in main
assert args.out.endswith(('.pkl', '.pickle')), \
AssertionError: The dump file must be a pkl file.
Then I found a .json file including the evaluation results and the setting recording file.
When I chose to add a key-value to the config file.
One type error came out: File "/home/xuym/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/registry.py", line 570, in build
return self.build_func(cfg, *args, kwargs, registry=self)
File "/home/xuym/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
obj = obj_cls(args) # type: ignore
TypeError: init() got an unexpected keyword argument 'output_dir'
测试并保存分割结果 基础使用 当需要保存测试输出的分割结果,用 --out 指定分割结果输出路径
python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} --out ${OUTPUT_DIR} 以保存模型 fcn_r50-d8_4xb4-80k_ade20k-512x512 在 ADE20K 验证数据集上的结果为例:
python tools/test.py configs/fcn/fcn_r50-d8_4xb4-80k_ade20k-512x512.py ckpt/fcn_r50-d8_512x512_80k_ade20k_20200614_144016-f8ac5082.pth --out work_dirs/format_results 或者通过配置文件定义 output_dir。例如在 configs/fcn/fcn_r50-d8_4xb4-80k_ade20k-512x512.py 添加 test_evaluator 定义:
test_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU'], output_dir='work_dirs/format_results') 然后执行相同功能的命令不需要再使用 --out:
python tools/test.py configs/fcn/fcn_r50-d8_4xb4-80k_ade20k-512x512.py ckpt/fcn_r50-d8_512x512_80k_ade20k_20200614_144016-f8ac5082.pth 当测试的数据集没有提供标注,评测时没有真值可以参与计算,因此需要设置 format_only=True, 同时需要修改 test_dataloader,由于没有标注,我们需要在数据增强变换中删掉 dict(type='LoadAnnotations'),以下是一个配置示例:
test_evaluator = dict( type='IoUMetric', iou_metrics=['mIoU'], format_only=True, output_dir='work_dirs/format_results') test_dataloader = dict( batch_size=1, num_workers=4, persistent_workers=True, sampler=dict(type='DefaultSampler', shuffle=False), dataset=dict( type = 'ADE20KDataset' data_root='data/ade/release_test', data_prefix=dict(img_path='testing'),
测试数据变换中没有加载标注
然后执行测试命令:
python tools/test.py configs/fcn/fcn_r50-d8_4xb4-80k_ade20k-512x512.py ckpt/fcn_r50-d8_512x512_80k_ade20k_20200614_144016-f8ac5082.pth
When I run my file, both changing the terminal command and adding a key_val to the evaluate dict are not work well. Let me show you:
This one came out when I type in this command:python tools/test.py configs/mask_rcnn_semi_auto_germinal_center/config_inference.py work_dirs/mask-rcnn_r50-caffe_fpn_ms-poly-1x_germinal_center/epoch_15.pth
after_run: (BELOW_NORMAL) LoggerHook
Traceback (most recent call last): File "tools/test.py", line 149, in
main()
File "tools/test.py", line 139, in main
assert args.out.endswith(('.pkl', '.pickle')), \
AssertionError: The dump file must be a pkl file.
Then I found a .json file including the evaluation results and the setting recording file.
When I chose to add a key-value to the config file. One type error came out: File "/home/xuym/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/registry.py", line 570, in build return self.build_func(cfg, *args, kwargs, registry=self) File "/home/xuym/miniconda3/envs/openmmlab/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg obj = obj_cls(args) # type: ignore TypeError: init() got an unexpected keyword argument 'output_dir'