bubbliiiing / yolox-pytorch

这是一个yolox-pytorch的源码,可以用于训练自己的模型。
Apache License 2.0
877 stars 184 forks source link

在运行get_map.py评估自己数据集的时候,发现自己训练的模型出现如下问题,请问该怎么解决? #148

Closed Adrian19970116 closed 4 months ago

Adrian19970116 commented 1 year ago

Load model. Traceback (most recent call last): File "get_map.py", line 92, in yolo = YOLO(confidence = confidence, nms_iou = nms_iou) File "/home/adrian/desktop/yolox-pytorch-main/yolo.py", line 85, in init self.generate() File "/home/adrian/desktop/yolox-pytorch-main/yolo.py", line 95, in generate self.net.load_state_dict(torch.load(self.model_path, map_location=device)) File "/home/adrian/anaconda3/envs/pytorch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 2041, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for YoloBody: size mismatch for head.cls_preds.0.weight: copying a param with shape torch.Size([12, 320, 1, 1]) from checkpoint, the shape in current model is torch.Size([80, 320, 1, 1]). size mismatch for head.cls_preds.0.bias: copying a param with shape torch.Size([12]) from checkpoint, the shape in current model is torch.Size([80]). size mismatch for head.cls_preds.1.weight: copying a param with shape torch.Size([12, 320, 1, 1]) from checkpoint, the shape in current model is torch.Size([80, 320, 1, 1]). size mismatch for head.cls_preds.1.bias: copying a param with shape torch.Size([12]) from checkpoint, the shape in current model is torch.Size([80]). size mismatch for head.cls_preds.2.weight: copying a param with shape torch.Size([12, 320, 1, 1]) from checkpoint, the shape in current model is torch.Size([80, 320, 1, 1]). size mismatch for head.cls_preds.2.bias: copying a param with shape torch.Size([12]) from checkpoint, the shape in current model is torch.Size([80]).

bubbliiiing commented 1 year ago

种类对应的txt没换哦