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

RuntimeError: Error(s) in loading state_dict for ShuffleNetV2: #7

Open
BarryKCL opened this issue Oct 16, 2020 · 1 comment
Open

RuntimeError: Error(s) in loading state_dict for ShuffleNetV2: #7

BarryKCL opened this issue Oct 16, 2020 · 1 comment

Comments

@BarryKCL
Copy link

[root@e31325cc657e FIIQA-PyTorch]# python3 test.py
Traceback (most recent call last):
File "test.py", line 48, in
net.load_state_dict(checkpoint['net'])
File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 1045, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for ShuffleNetV2:
size mismatch for classifier.0.weight: copying a param with shape torch.Size([200, 1024]) from checkpoint, the shape in current model is torch.Size([160, 1024]).
size mismatch for classifier.0.bias: copying a param with shape torch.Size([200]) from checkpoint, the shape in current model is torch.Size([160]).

@rocinant
Copy link

rocinant commented Oct 20, 2020

change inputSize to 200, and transforms.Resize(224), take some time to read original repo and paper
anyway, after pillow load the image with face = Image.open(image_path), resize it to (224, 224), then transforms.Resize(224), load model with net = ShuffleNetV2(200), shold be okay now.

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

2 participants