Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'Non-existent config key: MODEL.PRETRAINED_MODELS' #9

Open
ghost opened this issue Mar 8, 2019 · 14 comments
Open

KeyError: 'Non-existent config key: MODEL.PRETRAINED_MODELS' #9

ghost opened this issue Mar 8, 2019 · 14 comments

Comments

@ghost
Copy link

ghost commented Mar 8, 2019

Traceback (most recent call last):
File "tools/train_net.py", line 171, in
main()
File "tools/train_net.py", line 143, in main
cfg.merge_from_file(args.config_file)
File "/usr/local/lib/python3.6/dist-packages/yacs/config.py", line 213, in merge_from_file
self.merge_from_other_cfg(cfg)
File "/usr/local/lib/python3.6/dist-packages/yacs/config.py", line 217, in merge_from_other_cfg
_merge_a_into_b(cfg_other, self, self, [])
File "/usr/local/lib/python3.6/dist-packages/yacs/config.py", line 460, in _merge_a_into_b
_merge_a_into_b(v, b[k], root, key_list + [k])
File "/usr/local/lib/python3.6/dist-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.PRETRAINED_MODELS'

@zjhuang22
Copy link
Owner

Traceback (most recent call last):
File "tools/train_net.py", line 171, in
main()
File "tools/train_net.py", line 143, in main
cfg.merge_from_file(args.config_file)
File "/usr/local/lib/python3.6/dist-packages/yacs/config.py", line 213, in merge_from_file
self.merge_from_other_cfg(cfg)
File "/usr/local/lib/python3.6/dist-packages/yacs/config.py", line 217, in merge_from_other_cfg
_merge_a_into_b(cfg_other, self, self, [])
File "/usr/local/lib/python3.6/dist-packages/yacs/config.py", line 460, in _merge_a_into_b
_merge_a_into_b(v, b[k], root, key_list + [k])
File "/usr/local/lib/python3.6/dist-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.PRETRAINED_MODELS'

I have updated my pre-trained models in README.md. You can download the pre-trained models and put them in the pretrained_models dir.

@ghost
Copy link
Author

ghost commented Mar 8, 2019

I have put both the R-101.pkl and R-50.pkl files in the pretrained directory and still getting the same error

@huanhuancao
Copy link

@ak9250 so have you solved that error? I got the same error.

@huanhuancao
Copy link

@ak9250 I solved the problem. Just add the "key=value" to the correct place of PY file ~/maskscoring_rcnn/maskrcnn_benchmark/config/defaults.py. For example, add "_C.MODEL.PRETRAINED_MODELS = 'pretrained_models'" on line 24.

@ghost
Copy link
Author

ghost commented Mar 18, 2019

@maomaochongchh did you delete what was on line 24 and then add that now i am getting
Traceback (most recent call last):
File "/content/maskscoring_rcnn/tools/train_net.py", line 8, in
from maskrcnn_benchmark.utils.env import setup_environment # noqa F401 isort:skip
ModuleNotFoundError: No module named 'maskrcnn_benchmark'

@huanhuancao
Copy link

@ak9250 No, just add a line. As for your new error, I think you should make sure that you run it in correct environment and path. And if you want to know clearly why the previous error happened, you should spent sometime to see the function "merge_from_file()".

@aguang1201
Copy link

I added "_C.MODEL.PRETRAINED_MODELS = 'pretrained_models'",but still got error. _pickle.UnpicklingError: invalid load key, '<'.

@YubinXie
Copy link

YubinXie commented Mar 27, 2019

@aguang1201 I got the same error when loading the model.

Mask-RCNN/maskscoring_rcnn-master/maskrcnn_benchmark/utils/c2_model_loading.py in _load_c2_pickled_weights(file_path)
    122     with open(file_path, "rb") as f:
    123         if torch._six.PY3:
--> 124             data = pickle.load(f, encoding="latin1")
    125         else:
    126             data = pickle.load(f)

UnpicklingError: invalid load key, '<'.

I found this is path problem. The file-path in the code is like './pretrained_model/***'. So you have to put your Jupiter/script file in the same director as pre_train folder.

@13012476909
Copy link

I got the another error.
KeyError: 'Non-existent config key: MODEL.MASKIOU_ON'

@Auth0rM0rgan
Copy link

Hey @13012476909
Did you solve it? I’m getting the same error

@deepaksinghcv
Copy link

The issue still persists.
Has anyone solved it?

@deepaksinghcv
Copy link

I have put both the R-101.pkl and R-50.pkl files in the pretrained directory and still getting the same error

From where did you get those files?

@zx1234-p
Copy link

@aguang1201 I got the same error when loading the model.

Mask-RCNN/maskscoring_rcnn-master/maskrcnn_benchmark/utils/c2_model_loading.py in _load_c2_pickled_weights(file_path)
    122     with open(file_path, "rb") as f:
    123         if torch._six.PY3:
--> 124             data = pickle.load(f, encoding="latin1")
    125         else:
    126             data = pickle.load(f)

UnpicklingError: invalid load key, '<'.

I found this is path problem. The file-path in the code is like './pretrained_model/***'. So you have to put your Jupiter/script file in the same director as pre_train folder.

@aguang1201 I got the same error when loading the model.

Mask-RCNN/maskscoring_rcnn-master/maskrcnn_benchmark/utils/c2_model_loading.py in _load_c2_pickled_weights(file_path)
    122     with open(file_path, "rb") as f:
    123         if torch._six.PY3:
--> 124             data = pickle.load(f, encoding="latin1")
    125         else:
    126             data = pickle.load(f)

UnpicklingError: invalid load key, '<'.

I found this is path problem. The file-path in the code is like './pretrained_model/***'. So you have to put your Jupiter/script file in the same director as pre_train folder.

怎么弄?还是不行

@redreda
Copy link

redreda commented Aug 20, 2022

I have solved this problem by adding a line "cfg.set_new_allowed(True)" before "cfg.merge_from_file(args.config_file)" in my .py file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants