Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error: size mismatch #257

Open
yamiefun opened this issue Apr 7, 2021 · 0 comments
Open

Runtime error: size mismatch #257

yamiefun opened this issue Apr 7, 2021 · 0 comments

Comments

@yamiefun
Copy link

yamiefun commented Apr 7, 2021

Hi,
I'm running the google colab provided in README, and I want to subtitude the model to HRNetv2. I download the weights file for encoder and decoder from the link provided in README, and modify the net_encoder and net_decoder weights in the colab, but encounter some error. Here is the error message, do I need to modify anything else?

Loading weights for net_encoder

RuntimeError Traceback (most recent call last)
in ()
4 fc_dim=2048,
5 #weights='ckpt/ade20k-resnet50dilated-ppm_deepsup/encoder_epoch_20.pth')
----> 6 weights='drive/MyDrive/corner/encoder_epoch_30.pth')
7 net_decoder = ModelBuilder.build_decoder(
8 arch='ppm_deepsup',

1 frames
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
1222 if len(error_msgs) > 0:
1223 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
-> 1224 self.class.name, "\n\t".join(error_msgs)))
1225 return _IncompatibleKeys(missing_keys, unexpected_keys)
1226

RuntimeError: Error(s) in loading state_dict for ResnetDilated:
size mismatch for layer1.0.conv1.weight: copying a param with shape torch.Size([64, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 128, 1, 1]).
size mismatch for layer1.0.downsample.0.weight: copying a param with shape torch.Size([256, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant