uber-research / DeepPruner

DeepPruner: Learning Efficient Stereo Matching via Differentiable PatchMatch (ICCV 2019)
Other
354 stars 41 forks source link

RuntimeError: Error(s) in loading state_dict for DataParallel: Missing key(s) in state_dict: "module.feature_extraction.branch1.1.0.weight", #25

Closed Diksha-Moolchandani closed 3 years ago

Diksha-Moolchandani commented 3 years ago

Hi,

I am getting the following error. Can you let me know how to solve this? This happens only for the DeepPruner-fast*.tar models.

File "/root/anaconda3/envs/mccnn_env/lib/python2.7/site-packages/torch/nn/modules/module.py", line 769, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for DataParallel: Missing key(s) in state_dict: "module.feature_extraction.branch1.1.0.weight", "module.feature_extraction.branch1.1.1.running_var", "module.feature_extraction.branch1.1.1.bias", "module.feature_extraction.branch1.1.1.weight", "module.feature_extraction.branch1.1.1.running_mean". Unexpected key(s) in state_dict: "module.refinement_net1.conv1.0.0.weight", "module.refinement_net1.conv1.0.1.weight", "module.refinement_net1.conv1.0.1.bias", "module.refinement_net1.conv1.0.1.running_mean", "module.refinement_net1.conv1.0.1.running_var", "module.refinement_net1.conv1.0.1.num_batches_tracked", "module.refinement_net1.conv1.1.0.weight", "module.refinement_net1.conv1.1.1.weight", "module.refinement_net1.conv1.1.1.bias", "module.refinement_net1.conv1.1.1.running_mean", "module.refinement_net1.conv1.1.1.running_var", "module.refinement_net1.conv1.1.1.num_batches_tracked", "module.refinement_net1.conv1.2.0.weight", "module.refinement_net1.conv1.2.1.weight", "module.refinement_net1.conv1.2.1.bias", "module.refinement_net1.conv1.2.1.running_mean", "module.refinement_net1.conv1.2.1.running_var", "module.refinement_net1.conv1.2.1.num_batches_tracked", "module.refinement_net1.conv1.3.0.weight", "module.refinement_net1.conv1.3.1.weight", "module.refinement_net1.conv1.3.1.bias", "module.refinement_net1.conv1.3.1.running_mean", "module.refinement_net1.conv1.3.1.running_var", "module.refinement_net1.conv1.3.1.num_batches_tracked", "module.refinement_net1.conv1.4.0.weight", "module.refinement_net1.conv1.4.1.weight", "module.refinement_net1.conv1.4.1.bias", "module.refinement_net1.conv1.4.1.running_mean", "module.refinement_net1.conv1.4.1.running_var", "module.refinement_net1.conv1.4.1.num_batches_tracked", "module.refinement_net1.conv1.5.0.weight", "module.refinement_net1.conv1.5.1.weight", "module.refinement_net1.conv1.5.1.bias", "module.refinement_net1.conv1.5.1.running_mean", "module.refinement_net1.conv1.5.1.running_var", "module.refinement_net1.conv1.5.1.num_batches_tracked", "module.refinement_net1.classif1.weight". size mismatch for module.refinement_net.conv1.0.0.weight: copying a param with shape torch.Size([32, 74, 3, 3]) from checkpoint, the shape in current model is torch.Size([32, 42, 3, 3]). size mismatch for module.feature_extraction.lastconv.0.0.weight: copying a param with shape torch.Size([128, 352, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 320, 3, 3]).

ShivamDuggal4 commented 3 years ago

Hi @Diksha-Moolchandani It looks like your config file is set for DeepPruner-best instead of DeepPruner-fast.

Please change your config file as mentioned here to use DeepPruner-fast.

https://github.com/uber-research/DeepPruner/blob/40b188cf954577e21d5068db2be2bedc6b0e8781/deeppruner/models/config.py#L30

Hopefully, this should resolve the issue.

Diksha-Moolchandani commented 3 years ago

It worked after changing one more line: https://github.com/uber-research/DeepPruner/blob/40b188cf954577e21d5068db2be2bedc6b0e8781/deeppruner/models/config.py#L48

Thanks. Great work and a very well documented and organized code.