amanchadha / iSeeBetter

iSeeBetter: Spatio-Temporal Video Super Resolution using Recurrent-Generative Back-Projection Networks | Python3 | PyTorch | GANs | CNNs | ResNets | RNNs | Published in Springer Journal of Computational Visual Media, September 2020, Tsinghua University Press
https://arxiv.org/abs/2006.11161
MIT License
359 stars 68 forks source link

Errror loading pretrained model #36

Open ipereira-uib opened 3 years ago

ipereira-uib commented 3 years ago

Where i try to test the model with a diferents weights of netG_epoch_4_1.pth It shows me the following error: Traceback (most recent call last): File "/content/drive/MyDrive/iSeeBetter/utils.py", line 19, in loadPreTrainedModel model.load_state_dict(state_dict) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 845, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Net: Missing key(s) in state_dict: "feat0.conv.weight", "feat0.conv.bias", "feat0.act.weight", "feat1.conv.weight", "feat1.conv.bias", "feat1.act.weight", "DBPN.feat1.conv.weight", "DBPN.feat1.conv.bias", "DBPN.feat1.act.weight", "DBPN.up1.up_conv1.deconv.weight", "DBPN.up1.up_conv1.deconv.bias", "DBPN.up1.up_conv1.act.weight", "DBPN.up1.up_conv2.conv.weight", "DBPN.up1.up_conv2.conv.bias", "DBPN.up1.up_conv2.act.weight", "DBPN.up1.up_conv3.deconv.weight", ...

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "iSeeBetterTest.py", line 213, in eval() File "iSeeBetterTest.py", line 95, in eval utils.loadPreTrainedModel(gpuMode=args.gpu_mode, model=model, modelPath=modelPath) File "/content/drive/MyDrive/iSeeBetter/utils.py", line 32, in loadPreTrainedModel model.load_state_dict(new_state_dict) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 845, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Net: Missing key(s) in state_dict: "feat0.conv.weight", "feat0.conv.bias", "feat0.act.weight", "feat1.conv.weight", "feat1.conv.bias", "feat1.act.weight", "DBPN.feat1.conv.weight", "DBPN.feat1.conv.bias", "DBPN.feat1.act.weight", "DBPN.up1.up_conv1.deconv.weight", "DBPN.up1.up_conv1.deconv.bias", "DBPN.up1.up_conv1.act.weight", "DBPN.up1.up_conv2.conv.weight", "DBPN.up1.up_conv2.conv.bias", "DBPN.up1.up_conv2.act.weight", "DBPN.up1.up_conv3.deconv.weight", "DBPN.up1.up_conv3.deconv.bias", "DBPN.up1.up_conv3.act.weight", "DBPN.down1.down_conv1.conv.weight", "DBPN.down1.down_conv1.conv.bias", "DBPN.down1.down_conv1.act.weight", "DBPN.down1.down_conv2.deconv.weight", "DBPN.down1.down_conv2.deconv.bias", "DBPN.down1.down_conv2.act.weight", "DBPN.down1.down_conv3.conv.weight", ...

BLCKEAGLE4 commented 3 years ago

I'm facing the same issue. In utils.py if you replace model.load_state_dict(new_state_dict) with model.load_state_dict(new_state_dict, strict = False) then it seems that might work, but this solution will cause other problems to the results. Did you find other solution?

BLCKEAGLE4 commented 3 years ago

@ipereira-uib Did you solve it? I have the same problem

ipereira-uib commented 3 years ago

I don't solve it. If I find the problem I will post it here. :(

BLCKEAGLE4 commented 3 years ago

I'm facing the same issue only when I try to load the pre-trained RBPN_4x model in training.
Ok thank you

CybotDNA commented 3 years ago

I have the same error. What kind of system do you use? I use Windows 11, anaconda and a RTX3060

Maybe it is a pyflow issue with windows?

[pip3] numpy==1.17.0 [pip3] torch==1.9.1+cu111 [pip3] torchaudio==0.9.1 [pip3] torchvision==0.10.1+cu111 [conda] _pytorch_select 0.1 cpu_0 [conda] blas 1.0 mkl [conda] libmklml 2019.0.5 haa95532_0 [conda] mkl 2019.4 245 [conda] mkl-service 2.3.0 py37h196d8e1_0 [conda] mkl_fft 1.3.0 py37h46781fe_0 [conda] mkl_random 1.0.4 py37h343c172_0 [conda] numpy 1.17.0 py37h19fb1c0_0 [conda] numpy-base 1.17.0 py37hc3f5095_0 [conda] torch 1.9.1+cu111 pypi_0 pypi [conda] torchaudio 0.9.1 pypi_0 pypi [conda] torchvision 0.10.1+cu111 pypi_0 pypi