Closed ingale726 closed 3 years ago
简单改了之后报错: RuntimeError: Error(s) in loading state_dict for ResNet: Missing key(s) in state_dict: "toplayer.bias", "toplayer.weight", "toplayer_bn.running_var", "toplayer_bn.bias", "toplayer_bn.weight", "toplayer_bn.running_mean", "smooth1.bias", "smooth1.weight", "smooth1_bn.running_var", "smooth1_bn.bias", "smooth1_bn.weight", "smooth1_bn.running_mean", "smooth2.bias", "smooth2.weight", "smooth2_bn.running_var", "smooth2_bn.bias", "smooth2_bn.weight", "smooth2_bn.running_mean", "smooth3.bias", "smooth3.weight", "smooth3_bn.running_var", "smooth3_bn.bias", "smooth3_bn.weight", "smooth3_bn.running_mean", "latlayer1.bias", "latlayer1.weight", "latlayer1_bn.running_var", "latlayer1_bn.bias", "latlayer1_bn.weight", "latlayer1_bn.running_mean", "latlayer2.bias", "latlayer2.weight", "latlayer2_bn.running_var", "latlayer2_bn.bias", "latlayer2_bn.weight", "latlayer2_bn.running_mean", "latlayer3.bias", "latlayer3.weight", "latlayer3_bn.running_var", "latlayer3_bn.bias", "latlayer3_bn.weight", "latlayer3_bn.running_mean", "conv2.bias", "conv2.weight", "bn2.running_var", "bn2.bias", "bn2.weight", "bn2.running_mean", "conv3.bias", "conv3.weight". Unexpected key(s) in state_dict: "fc.weight", "fc.bias".
您把这些state_dict缺失的键值加上试试?
简单改了之后报错: RuntimeError: Error(s) in loading state_dict for ResNet: Missing key(s) in state_dict: "toplayer.bias", "toplayer.weight", "toplayer_bn.running_var", "toplayer_bn.bias", "toplayer_bn.weight", "toplayer_bn.running_mean", "smooth1.bias", "smooth1.weight", "smooth1_bn.running_var", "smooth1_bn.bias", "smooth1_bn.weight", "smooth1_bn.running_mean", "smooth2.bias", "smooth2.weight", "smooth2_bn.running_var", "smooth2_bn.bias", "smooth2_bn.weight", "smooth2_bn.running_mean", "smooth3.bias", "smooth3.weight", "smooth3_bn.running_var", "smooth3_bn.bias", "smooth3_bn.weight", "smooth3_bn.running_mean", "latlayer1.bias", "latlayer1.weight", "latlayer1_bn.running_var", "latlayer1_bn.bias", "latlayer1_bn.weight", "latlayer1_bn.running_mean", "latlayer2.bias", "latlayer2.weight", "latlayer2_bn.running_var", "latlayer2_bn.bias", "latlayer2_bn.weight", "latlayer2_bn.running_mean", "latlayer3.bias", "latlayer3.weight", "latlayer3_bn.running_var", "latlayer3_bn.bias", "latlayer3_bn.weight", "latlayer3_bn.running_mean", "conv2.bias", "conv2.weight", "bn2.running_var", "bn2.bias", "bn2.weight", "bn2.running_mean", "conv3.bias", "conv3.weight". Unexpected key(s) in state_dict: "fc.weight", "fc.bias".