File "train.py", line 74, in
model.load_state_dict(torch.load(opt.pretrained_weights))
File "/home/cendelian/anaconda3/envs/pytorch_tf/lib/python3.6/site-packages/torch/nn/modules/module.py", line 845, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Darknet:
size mismatch for module_list.0.conv_0.weight: copying a param with shape torch.Size([30, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([19, 3, 3, 3]).
size mismatch for module_list.0.batch_norm_0.weight: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.0.batch_norm_0.bias: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.0.batch_norm_0.running_mean: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.0.batch_norm_0.running_var: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.1.conv_1.weight: copying a param with shape torch.Size([64, 30, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 19, 3, 3]).
size mismatch for module_list.2.conv_2.weight: copying a param with shape torch.Size([28, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([25, 64, 1, 1]).
size mismatch for module_list.2.batch_norm_2.weight: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.2.batch_norm_2.bias: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.2.batch_norm_2.running_mean: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.2.batch_norm_2.running_var: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.3.conv_3.weight: copying a param with shape torch.Size([64, 28, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 25, 3, 3]).
你好 我运行test_prun.py得到剪枝的模型 然后运行
python train.py --model_def config/prune_yolov3-hand.cfg -pre checkpoin ts/prune_0.85_yolov3_ckpt_50_12291908.pth
prune_0.85_yolov3_ckpt_50_12291908.pthweights剪枝得到的模型 报错了,错误信息如下:请问是哪里除了问题呢
File "train.py", line 74, in
model.load_state_dict(torch.load(opt.pretrained_weights))
File "/home/cendelian/anaconda3/envs/pytorch_tf/lib/python3.6/site-packages/torch/nn/modules/module.py", line 845, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Darknet:
size mismatch for module_list.0.conv_0.weight: copying a param with shape torch.Size([30, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([19, 3, 3, 3]).
size mismatch for module_list.0.batch_norm_0.weight: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.0.batch_norm_0.bias: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.0.batch_norm_0.running_mean: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.0.batch_norm_0.running_var: copying a param with shape torch.Size([30]) from checkpoint, the shape in current model is torch.Size([19]).
size mismatch for module_list.1.conv_1.weight: copying a param with shape torch.Size([64, 30, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 19, 3, 3]).
size mismatch for module_list.2.conv_2.weight: copying a param with shape torch.Size([28, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([25, 64, 1, 1]).
size mismatch for module_list.2.batch_norm_2.weight: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.2.batch_norm_2.bias: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.2.batch_norm_2.running_mean: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.2.batch_norm_2.running_var: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([25]).
size mismatch for module_list.3.conv_3.weight: copying a param with shape torch.Size([64, 28, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 25, 3, 3]).