(26)RuntimeError: Error(s) in loading state_dict for YoloBody:size mismatch for yolo_head3.1.weight

Run B_ Yolov4 an error is reported when calculating the map:

RuntimeError: Error(s) in loading state_dict for YoloBody:
	size mismatch for yolo_head3.1.weight: copying a param with shape torch.Size([75, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([255, 256, 1, 1]).
	size mismatch for yolo_head3.1.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([255]).
	size mismatch for yolo_head2.1.weight: copying a param with shape torch.Size([75, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([255, 512, 1, 1]).
	size mismatch for yolo_head2.1.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([255]).
	size mismatch for yolo_head1.1.weight: copying a param with shape torch.Size([75, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([255, 1024, 1, 1]).
	size mismatch for yolo_head1.1.bias: copying a param with shape torch.Size([75]) from checkpoint, the shape in current model is torch.Size([255]).

resolvent:

Check class in train.py_ Names and num_ The classes are all right, so it is determined that it is a problem in several programs called when calculating map. Finally, it is found that the number of classes in yolo.py is wrong,

"classes_path"      : 'model_data/coco_classes.txt',

Replace with:

"classes_path"      : 'model_data/voc_classes.txt',

ginseng https://github.com/bubbliiiing/yolo3-pytorch/issues/17

https://blog.csdn.net/nangg1047/article/details/116073131


Read More: