zjhuang22 / maskscoring_rcnn

Codes for paper "Mask Scoring R-CNN".
MIT License
1.9k stars 378 forks source link

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

Open ak9250 opened 5 years ago

ak9250 commented 5 years ago

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 commented 5 years ago

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.

ak9250 commented 5 years ago

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

huanhuancao commented 5 years ago

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

huanhuancao commented 5 years ago

@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.

ak9250 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

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

YubinXie commented 5 years ago

@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 commented 5 years ago

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

Auth0rM0rgan commented 4 years ago

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

deepaksinghcv commented 4 years ago

The issue still persists. Has anyone solved it?

deepaksinghcv commented 4 years ago

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 commented 3 years ago

@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 commented 2 years ago

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.