krumo / Domain-Adaptive-Faster-RCNN-PyTorch

Domain Adaptive Faster R-CNN in PyTorch
MIT License
304 stars 68 forks source link

KeyError: 'Non-existent config key: MODEL.DOMAIN_ADAPTATION_ON' caused by cfg.merge_from_file #4

Closed WanyiLi closed 4 years ago

WanyiLi commented 4 years ago

Hi, when i run the script to test trained model, KeyError occurs. the used script: python tools/test_net.py --config_file "configs/da_faster_rcnn/e2e_da_faster_rcnn_R_50_C4_cityscapes_to_foggy_cityscapes.yaml" MODEL.WEIGHT trainedmodels/model_final.pth detailed error: Traceback (most recent call last): File "tools/test_net.py", line 98, in main() File "tools/test_net.py", line 50, in main cfg.merge_from_file(args.config_file) File "/home/casia_robot_lwy/anaconda3/envs/py3_env/lib/python3.7/site-packages/yacs/config.py", line 213, in merge_from_file self.merge_from_other_cfg(cfg) File "/home/casia_robot_lwy/anaconda3/envs/py3_env/lib/python3.7/site-packages/yacs/config.py", line 217, in merge_from_other_cfg _merge_a_into_b(cfg_other, self, self, []) File "/home/casia_robot_lwy/anaconda3/envs/py3_env/lib/python3.7/site-packages/yacs/config.py", line 460, in _merge_a_into_b _merge_a_into_b(v, b[k], root, key_list + [k]) File "/home/casia_robot_lwy/anaconda3/envs/py3_env/lib/python3.7/site-packages/yacs/config.py", line 473, in _merge_a_into_b raise KeyError("Non-existent config key: {}".format(full_key)) KeyError: 'Non-existent config key: MODEL.DOMAIN_ADAPTATION_ON'

krumo commented 4 years ago

@WanyiLi Hi, did you solve this problem? As I mentioned in the installation instruction, you have to follow the instructions in maskrcnn_benchmark to install this repo. Specifically, you have to download this repo and compile this repo locally so that your environment could find the key 'MODEL.DOMAIN_ADAPTATION_ON' defined in the config file.

WanyiLi commented 4 years ago

@krumo Thank you. This problem is solved by copy maskrcnn_benchmark files of this repo to installation dir of maskrcnn-benchmark library. Any other undefined key can also be defined in the installed config definition file, i.e. maskrcnn-benchmark/maskrcnn_benchmark/config/defaults.py. Thanks again!