SA-SSD icon indicating copy to clipboard operation
SA-SSD copied to clipboard

KeyError: 'model_state' ----- evaluate the the pretrained model

Open jlqzzz opened this issue 4 years ago • 7 comments

I download the pretrained model, and evaluate the model: cd tools python3 test.py ../configs/car_cfg.py ../saved_model_vehicle/epoch_50.pth

Then the error occur:

==> Loading parameters from checkpoint ../saved_model_vehicle/epoch_50.pth to GPU Traceback (most recent call last): File "test.py", line 159, in main() File "test.py", line 141, in main load_params_from_file(model, args.checkpoint) File "/home/zzz/SA-SSD/tools/train_utils/init.py", line 157, in load_params_from_file model_state_disk = checkpoint['model_state'] KeyError: 'model_state'

Does anyone know how to solve this problem? Thank you very much!

jlqzzz avatar Apr 27 '20 04:04 jlqzzz

You should change key to load model. Print checkpoint.keys() first to see options, and choice right one. BTW after that you got load weights problem, caused my DataParallel apply - easy add 'model.' at the start of weights alias/key in OrderedDict in model state.

stalkermustang avatar Apr 27 '20 10:04 stalkermustang

I download the pretrained model, and evaluate the model: cd tools python3 test.py ../configs/car_cfg.py ../saved_model_vehicle/epoch_50.pth

Then the error occur:

==> Loading parameters from checkpoint ../saved_model_vehicle/epoch_50.pth to GPU Traceback (most recent call last): File "test.py", line 159, in main() File "test.py", line 141, in main load_params_from_file(model, args.checkpoint) File "/home/zzz/SA-SSD/tools/train_utils/init.py", line 157, in load_params_from_file model_state_disk = checkpoint['model_state'] KeyError: 'model_state'

Does anyone know how to solve this problem? Thank you very much!

I also meet this problem. Have you solved it ?

mengxingshifen1218 avatar Jun 29 '20 07:06 mengxingshifen1218

https://github.com/skyhehe123/SA-SSD/issues/19#issuecomment-619886333 @mengxingshifen1218

stalkermustang avatar Jun 29 '20 07:06 stalkermustang

#19 (comment) @mengxingshifen1218

thank you!

mengxingshifen1218 avatar Jun 29 '20 07:06 mengxingshifen1218

@mengxingshifen1218: Can you share how to solve your model_state issue using the comment #19 (comment) from @stalkermustang? Thanks.

ipie2050 avatar Jul 12 '20 00:07 ipie2050

@mengxingshifen1218: Can you share how to solve your model_state issue using the comment #19 (comment) from @stalkermustang? Thanks.

You can train this model by yourself,it will be ok.

mengxingshifen1218 avatar Jul 28 '20 12:07 mengxingshifen1218

Check my answer at duplicate issue. I have provided code to load pretrained model without any training there.

dimitree54 avatar Nov 17 '20 07:11 dimitree54