zanilzanzan / FuseNet_PyTorch

Joint scene classification and semantic segmentation with FuseNet
GNU General Public License v3.0
108 stars 34 forks source link

Loading pretrained model doesn't work #7

Closed Oguked closed 6 years ago

Oguked commented 6 years ago

When I try to load the NYU pretrained model I get the following size mismatch error message:

Traceback (most recent call last): File "", line 1, in runfile('/home/fapsros/catkin_ws/src/human_body_localization/src/FuseNet/fusenet_faps.py', wdir='/home/fapsros/catkin_ws/src/human_body_localization/src/FuseNet') File "/home/fapsros/.conda/envs/fusenet/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 668, in runfile execfile(filename, namespace) File "/home/fapsros/.conda/envs/fusenet/lib/python2.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 100, in execfile builtins.execfile(filename, *where) File "/home/fapsros/catkin_ws/src/human_body_localization/src/FuseNet/fusenet_faps.py", line 96, in main() File "/home/fapsros/catkin_ws/src/human_body_localization/src/FuseNet/fusenet_faps.py", line 68, in main best_model.load_state_dict(checkpoint['best_state_dict']) File "/home/fapsros/.conda/envs/fusenet/lib/python2.7/site-packages/torch/nn/modules/module.py", line 719, in load_state_dict self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for FuseNet: size mismatch for conv11d.weight: copying a param of torch.Size([64, 3, 3]) from checkpoint, where the shape is torch.Size([64, 1, 3, 3]) in current model.

hazirbas commented 6 years ago

Please check issue #2

Oguked commented 6 years ago

It was the same problem as before: using PyTorch 0.1.12 instead of 0.3.1 solved it for me.