sanghyun-son / EDSR-PyTorch

PyTorch version of the paper 'Enhanced Deep Residual Networks for Single Image Super-Resolution' (CVPRW 2017)
MIT License
2.42k stars 668 forks source link

Unexpected key when resuming the model. #26

Closed lewisyangliu closed 6 years ago

lewisyangliu commented 6 years ago

Hi, thank you for sharing your code. I can run your train model (EDSR_x2) successfully, but when resuming the model the following error occurs:

File "user path/EDSR-PyTorch-master/code/utility.py", line 127, in load torch.load(self.dir + '/model/model_latest.pt')) File "/home/cggi/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 522, in load_state_dict .format(name)) KeyError: 'unexpected key "sub_mean.weight" in state_dict'

I just use this command: python main.py --model EDSR --scale 2 --save EDSR_x2 --n_resblocks 32 --n_feats 256 --res_scale 0.1 --resume 46 --load EDSR_x2

Thanks!

sanghyun-son commented 6 years ago

Hello.

Unfortunately, I cannot figure out what the exact problem is. (Maybe your code is not the recent one.)

Also, there are some problems in --resume argument, so I do not recommend to use it.

I recommend you to run following script:

python main.py --model EDSR --scale 2 --save EDSR_x2_new --n_resblocks 32 --n_feats 256 --res_scale 0.1 --pre_train <your-model-path>

Thank you.

lewisyangliu commented 6 years ago

OK, thank you! Closing the issue.