xhwNobody / yolov5_prune_sfp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

权重剪裁这出错,如何解决

hwangyl opened this issue · comments

raceback (most recent call last):
File "D:/works/yolov5-prune-sfp-pruning-main/get_small_script/get_small_model.py", line 247, in
small_model = get_small_model(model)
File "D:/works/yolov5-prune-sfp-pruning-main/get_small_script/get_small_model.py", line 185, in get_small_model
small_model.load_state_dict(small_state_dict)
File "D:\ProgramData\Anaconda3\envs\pytorch-gpu1.8\lib\site-packages\torch\nn\modules\module.py", line 1224, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for Small_Model:
size mismatch for neck_self.conv1.conv.weight: copying a param with shape torch.Size([512, 716, 1, 1]) from checkpoint, the shape in current model is torch.Size([358, 716, 1, 1]).
size mismatch for neck_self.conv1.bn.weight: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([358]).
size mismatch for neck_self.conv1.bn.bias: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([358]).
size mismatch for neck_self.conv1.bn.running_mean: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([358]).
size mismatch for neck_self.conv1.bn.running_var: copying a param with shape torch.Size([512]) from checkpoint, the shape in current model is torch.Size([358]).
size mismatch for neck_self.csp1.cv1.conv.weight: copying a param with shape torch.Size([256, 870, 1, 1]) from checkpoint, the shape in current model is torch.Size([179, 716, 1, 1]).
size mismatch for neck_self.csp1.cv1.bn.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([179]).
size mismatch for neck_self.csp1.cv1.bn.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([179]).

你好,请问解决了吗,求解决方案