tanluren / yolov3-channel-and-layer-pruning

yolov3 yolov4 channel and layer pruning, Knowledge Distillation 层剪枝,通道剪枝,知识蒸馏
Apache License 2.0
1.5k stars 446 forks source link

RuntimeError: Error(s) in loading state_dict for Darknet: size mismatch for module_list.81.Conv2d.weight: copying a param with shape torch.Size([75, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([45, 1024, 1, 1]). #82

Open qaazii opened 4 years ago

qaazii commented 4 years ago

I am having this error after runnning test.py. i don't know whwhy it shows the filter size 75. how to change it ?

Kindly help.

python test.py --data data/fruit.data --cfg cfg/s_yolov3.cfg --weights weights/last.pt Namespace(batch_size=16, cfg='cfg/s_yolov3.cfg', conf_thres=0.001, data='data/fruit.data', device='', img_size=416, iou_thres=0.5, nms_thres=0.5, save_json=False, weights='weights/last.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce GTX 1080 Ti', total_memory=11264MB)

Traceback (most recent call last): File "test.py", line 222, in opt.save_json) File "test.py", line 33, in test model.load_state_dict(torch.load(weights, map_location=device)['model']) File "C:\Users\power703\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 777, 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.81.Conv2d.weight: copying a param with shape torch.Size([75, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([45, 1024, 1, 1]). size mismatch for module_list.81.Conv2d.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([45]). size mismatch for module_list.93.Conv2d.weight: copying a param with shape torch.Size([75, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([45, 512, 1, 1]). size mismatch for module_list.93.Conv2d.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([45]). size mismatch for module_list.105.Conv2d.weight: copying a param with shape torch.Size([75, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([45, 256, 1, 1]). size mismatch for module_list.105.Conv2d.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([45]).

tanluren commented 4 years ago

the pt does not match the cfg

ANZHIQIANG commented 3 years ago

I have the same question, have you solve the problem? Thank you.