RuntimeError: Error(s) in loading state_dict for ResNet: Missing key(s) in state_dict: "layer4.0.bn

最近找到了pytorch版本的pspnet,但是运行的时候却报了下面的错,折腾了好久,原来是pytorch版本的原因,

pip3 uninstall torch

pip3 install torch==0.3.1

即可解决问题.

RuntimeError: Error(s) in loading state_dict for ResNet:
    Missing key(s) in state_dict: "layer4.0.bn2.running_var", "layer4.0.bn2.running_mean", "layer4.0.conv3.weight", "layer4.0.bn3.weight", "layer4.0.bn3.running_var", "layer4.0.bn3.bias", "layer4.0.bn3.running_mean", "layer4.0.downsample.0.weight", "layer4.0.downsample.1.weight", "layer4.0.downsample.1.running_var", "layer4.0.downsample.1.bias", "layer4.0.downsample.1.running_mean", "layer4.1.conv1.weight", "layer4.1.bn1.weight", "layer4.1.bn1.running_var", "layer4.1.bn1.bias", "layer4.1.bn1.running_mean", "layer4.1.conv2.weight", "layer4.1.bn2.weight", "layer4.1.bn2.running_var", "layer4.1.bn2.bias", "layer4.1.bn2.running_mean", "layer4.1.conv3.weight", "layer4.1.bn3.weight", "layer4.1.bn3.running_var", "layer4.1.bn3.bias", "layer4.1.bn3.running_mean", "layer4.2.conv1.weight", "layer4.2.bn1.weight", "layer4.2.bn1.running_var", "layer4.2.bn1.bias", "layer4.2.bn1.running_mean", "layer4.2.conv2.weight", "layer4.2.bn2.weight", "layer4.2.bn2.running_var", "layer4.2.bn2.bias", "layer4.2.bn2.running_mean", "layer4.2.conv3.weight", "layer4.2.bn3.weight", "layer4.2.bn3.running_var", "layer4.2.bn3.bias", "layer4.2.bn3.running_mean".
    size mismatch for bn1.num_batches_tracked: copying a param of torch.Size([]) from checkpoint, where the shape is torch.Size([64, 64, 1, 1]) in current model.
    size mismatch for layer1.0.conv1.weight: copying a param of torch.Size([64, 64, 1, 1]) from checkpoint, where the shape is torch.Size([64]) in current model.

 

你可能感兴趣的:(RuntimeError: Error(s) in loading state_dict for ResNet: Missing key(s) in state_dict: "layer4.0.bn)