魔导,预测时候的label_path [是干啥的,权重文件路径怎么没有,一直预测错误。
RuntimeError: Error(s) in loading state_dict for ResNet:
Unexpected key(s) in state_dict: "total_ops", "total_params", "layer1.0.total_ops", "layer1.0.total_params", "layer1.1.total_ops", "layer1.1.total_params", "layer1.2.total_ops", "layer1.2.total_params", "layer2.0.total_ops", "layer2.0.total_params", "layer2.1.total_ops", "layer2.1.total_params", "layer2.2.total_ops", "layer2.2.total_params", "layer2.3.total_ops", "layer2.3.total_params", "layer3.0.total_ops", "layer3.0.total_params", "layer3.1.total_ops", "layer3.1.total_params", "layer3.2.total_ops", "layer3.2.total_params", "layer3.3.total_ops", "layer3.3.total_params", "layer3.4.total_ops", "layer3.4.total_params", "layer3.5.total_ops", "layer3.5.total_params", "layer4.0.total_ops", "layer4.0.total_params", "layer4.1.total_ops", "layer4.1.total_params", "layer4.2.total_ops", "layer4.2.total_params".
size mismatch for fc.1.weight: copying a param with shape torch.Size([5, 2048]) from checkpoint, the shape in current model is torch.Size([3674, 2048]).
size mismatch for fc.1.bias: copying a param with shape torch.Size([5]) from checkpoint, the shape in current model is torch.Size([3674]).
魔导,预测时候的label_path [是干啥的,权重文件路径怎么没有,一直预测错误。 RuntimeError: Error(s) in loading state_dict for ResNet: Unexpected key(s) in state_dict: "total_ops", "total_params", "layer1.0.total_ops", "layer1.0.total_params", "layer1.1.total_ops", "layer1.1.total_params", "layer1.2.total_ops", "layer1.2.total_params", "layer2.0.total_ops", "layer2.0.total_params", "layer2.1.total_ops", "layer2.1.total_params", "layer2.2.total_ops", "layer2.2.total_params", "layer2.3.total_ops", "layer2.3.total_params", "layer3.0.total_ops", "layer3.0.total_params", "layer3.1.total_ops", "layer3.1.total_params", "layer3.2.total_ops", "layer3.2.total_params", "layer3.3.total_ops", "layer3.3.total_params", "layer3.4.total_ops", "layer3.4.total_params", "layer3.5.total_ops", "layer3.5.total_params", "layer4.0.total_ops", "layer4.0.total_params", "layer4.1.total_ops", "layer4.1.total_params", "layer4.2.total_ops", "layer4.2.total_params". size mismatch for fc.1.weight: copying a param with shape torch.Size([5, 2048]) from checkpoint, the shape in current model is torch.Size([3674, 2048]). size mismatch for fc.1.bias: copying a param with shape torch.Size([5]) from checkpoint, the shape in current model is torch.Size([3674]).
parser = argparse.ArgumentParser() parser.add_argument('--model_name', type=str, default='resnet50', help='model name') parser.add_argument('--pretrained', action="store_false", help='using pretrain weight') parser.add_argument('--weight', type=str, default='', help='loading weight path') parser.add_argument('--config', type=str, default='config/config.py', help='config path') parser.add_argument('--device', type=str, default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')