xhwNobody/yolov5_prune_sfp

get_small_model.py出现维度不匹配

Closed this issue · 0 comments

运行get_small_model.py的时候,在
File "get_small_model.py", line 242, in
small_model = get_small_model(model)
File "get_small_model.py", line 186, in get_small_model
small_model.load_state_dict(small_state_dict)
File "/home/ctgai/anaconda3/envs/taco/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1052, 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]).
加载的模型是用的train_prune_sfp.py训练得到的模型,请问这是哪里的问题呢?