chenhsuanlin / photometric-mesh-optim

Photometric Mesh Optimization for Video-Aligned 3D Object Reconstruction :globe_with_meridians: (CVPR 2019)
MIT License
208 stars 25 forks source link

RuntimeError: Error(s) in loading state_dict for ModuleList: #13

Open CILT opened 2 years ago

CILT commented 2 years ago

Hi. I'm trying to pretrain AtlasNet, just as stated in the README, but I always get the error:

self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for ModuleList:
    Missing key(s) in state_dict: "0.conv1.weight", "0.conv1.bias", "0.conv2.weight", "0.conv2.bias", "0.conv3.weight", "0.conv3.bias" ... "23.bn3.running_var", "24.conv1.weight", "24.conv1.bias", "24.conv2.weight", "24.conv2.bias", "24.conv3.weight", "24.conv3.bias", "24.conv4.weight", "24.conv4.bias", "24.bn1.weight", "24.bn1.bias", "24.bn1.running_mean", "24.bn1.running_var", "24.bn2.weight", "24.bn2.bias", "24.bn2.running_mean", "24.bn2.running_var", "24.bn3.weight", "24.bn3.bias", "24.bn3.running_mean", "24.bn3.running_var"

Please, I reviewed the code, but I couldn't get it to work. I have the decoder under pretrained/ae_atlasnet_25.pth

Here is the complete stack trace:

loading training data...
number of samples: 3235
loading test data...
number of samples: 809
building AtlasNet...
loading pretrained encoder...
loading pretrained decoder (pretrained/ae_atlasnet_25.pth)...
Traceback (most recent call last):
  File "main_pretrain.py", line 18, in <module>
    trainer.build_network(opt)
  File "/home/cllullt/.../photometric-mesh-optim/model_pretrain.py", line 29, in build_network
    self.network = atlasnet.AtlasNet(opt)
  File "/home/cllullt/.../photometric-mesh-optim/atlasnet.py", line 21, in __init__
    self.load_pretrained_decoder(opt)
  File "/home/cllullt/.../photometric-mesh-optim/atlasnet.py", line 40, in load_pretrained_decoder
    self.decoder.load_state_dict(decoder_weight_dict)
  File "/home/cllullt/.../PMO/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 1483, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for ModuleList:
    Missing key(s) in state_dict: "0.conv1.weight", "0.conv1.bias", "0.conv2.weight", "0.conv2.bias", "0.conv3.weight", "0.conv3.bias" [the list continues...] "23.bn3.running_var", "24.conv1.weight", "24.conv1.bias", "24.conv2.weight", "24.conv2.bias", "24.conv3.weight", "24.conv3.bias", "24.conv4.weight", "24.conv4.bias", "24.bn1.weight", "24.bn1.bias", "24.bn1.running_mean", "24.bn1.running_var", "24.bn2.weight", "24.bn2.bias", "24.bn2.running_mean", "24.bn2.running_var", "24.bn3.weight", "24.bn3.bias", "24.bn3.running_mean", "24.bn3.running_var"

Best regards.

chenhsuanlin commented 2 years ago

Hi @CILT, it seems that the AtlasNet architecture has been greatly refactored since I released this project (2019). The new pretrained models are incompatible with this codebase. I tried to trace back and it seems that the download links to the old pretrained models have been removed, so unfortunately this is not a straightforward issue to fix. I would suggest either:

  1. Try training without loading the pretrained decoder, if it's not critical to your case.
  2. Incorporate the latest code from the new AtlasNet repo into atlasnet.py to read the new pretrained models.
  3. Reach out to the AtlasNet authors (@ThibaultGROUEIX) to see if the old models are still available.
CILT commented 2 years ago

Ok, thank you for your response and suggestions. I'll check it out.

Best regards.

ThibaultGROUEIX commented 2 years ago

hi @chenhsuanlin @CILT

You can try these weights : https://cloud.enpc.fr/s/3wBgadaERR7XiZL

Otherwise, I think the easiest thing to do would be to copy/paste AtlasNet new architecture from AtlasNet repo to this repo,

Best regards Thibault