Open BarryKCL opened 4 years ago
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.
[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]).