我尝试了几种可用的解决方案,但对我没有任何帮助。谁能帮忙解决这个问题?
Preprocessing..
Loading dataset...
Calculating mean & dev std...
Calculated mean and standard deviation!
Preprocessing finished!
Traceback (most recent call last):
File "main.py", line 226, in <module>
resnet152_model = resnet.resnet152(pretrained=True, **classes)
File "/home/aqsa/anaconda3/envs/VGG/lib/python3.7/site-packages/torchvision/models/resnet.py", line 279, in resnet152
**kwargs)
File "/home/aqsa/anaconda3/envs/VGG/lib/python3.7/site-packages/torchvision/models/resnet.py", line 218, in _resnet
model.load_state_dict(state_dict)
File "/home/aqsa/anaconda3/envs/VGG/lib/python3.7/site-packages/torch/nn/modules/module.py", line 841, in load_state_dict
self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for ResNet:
size mismatch for fc.weight: copying a param with shape torch.Size([1000, 2048]) from checkpoint, the shape in current model is torch.Size([3, 2048]).
size mismatch for fc.bias: copying a param with shape torch.Size([1000]) from checkpoint, the shape in current model is torch.Size([3]).