argusswift / YOLOv4-pytorch

This is a pytorch repository of YOLOv4, attentive YOLOv4 and mobilenet YOLOv4 with PASCAL VOC and COCO
1.68k stars 330 forks source link

更换数据集时出现ValueError: Target size (torch.Size([2, 52, 52, 3, 12])) must be the same as input size (torch.Size([2, 52, 52, 3, 10]))是什么原因 #236

Closed chennaikai11 closed 3 years ago

chennaikai11 commented 3 years ago

Traceback (most recent call last): File "train.py", line 366, in fp_16=opt.fp_16, File "train.py", line 200, in train lbboxes, File "R:\anaconda\envs\YOLOv4-PyTorch\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "R:\yolov4\model\loss\yolo_loss.py", line 65, in forward p[0], p_d[0], label_sbbox, sbboxes, strides[0] File "R:\yolov4\model\loss\yolo_loss.py", line 151, in __cal_loss_per_layer label_obj_mask BCE(input=p_cls, target=label_cls) label_mix File "R:\anaconda\envs\YOLOv4-PyTorch\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(input, **kwargs) File "R:\anaconda\envs\YOLOv4-PyTorch\lib\site-packages\torch\nn\modules\loss.py", line 632, in forward reduction=self.reduction) File "R:\anaconda\envs\YOLOv4-PyTorch\lib\site-packages\torch\nn\functional.py", line 2580, in binary_cross_entropy_with_logits raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size())) ValueError: Target size (torch.Size([2, 52, 52, 3, 12])) must be the same as input size (torch.Size([2, 52, 52, 3, 10]))