Getting the following error when trying to train yolo on a custom model. #1443
Replies: 1 comment
-
@swaroop116 hello! It looks like you're encountering a tensor size mismatch error during training. This typically indicates that there's an inconsistency in your dataset annotations or a misconfiguration in your dataset YAML file. Please ensure that your dataset is correctly formatted and that all annotations are consistent with the expected input for the model. The error suggests that there might be an issue with the 'cls' (class labels) or 'bboxes' (bounding boxes) dimensions in your batch data. Double-check your dataset's annotation files for any empty or incorrectly formatted entries. Also, verify that the paths and settings in your dataset YAML file are correct and match the structure of your dataset. If you've confirmed that your dataset and YAML file are in order, consider reviewing the data loading part of your code to ensure that the batches are being created properly. For more detailed guidance on preparing your dataset and YAML configuration, please refer to our documentation on custom training: https://docs.ultralytics.com/modes/train. If the issue persists, you can provide more details on the GitHub issue tracker, and we'll be happy to help you troubleshoot further. Good luck! 🚀 |
Beta Was this translation helpful? Give feedback.
-
Traceback (most recent call last):
![Screenshot 2023-03-15 174029](https://user-images.githubusercontent.com/71523052/225379675-1af19c86-77cd-4ab6-a87e-0358d64c81ab.png)
![Screenshot 2023-03-15 174051](https://user-images.githubusercontent.com/71523052/225379713-ad35cfb1-fef6-4b01-bf18-1ce4d30d12ee.png)
File "c:\Users\eaisacr\Downloads\cityscapes\leftImg8bit_trainvaltest\leftImg8bit\ddm.py", line 8, in
model.train(data="C:/Users/eaisacr/Downloads/VOCtrainval_06-Nov-2007/VOCdevkit/VOC2007/sdk.yaml", epochs=1, imgsz=640)
File "C:\Users\eaisacr\Anaconda3\lib\site-packages\ultralytics\yolo\engine\model.py", line 316, in train
self.trainer.train()
File "C:\Users\eaisacr\Anaconda3\lib\site-packages\ultralytics\yolo\engine\trainer.py", line 188, in train
self._do_train(RANK, world_size)
File "C:\Users\eaisacr\Anaconda3\lib\site-packages\ultralytics\yolo\engine\trainer.py", line 309, in _do_train
self.loss, self.loss_items = self.criterion(preds, batch)
File "C:\Users\eaisacr\Anaconda3\lib\site-packages\ultralytics\yolo\v8\segment\train.py", line 40, in criterion
return self.compute_loss(preds, batch)
File "C:\Users\eaisacr\Anaconda3\lib\site-packages\ultralytics\yolo\v8\segment\train.py", line 81, in call
targets = torch.cat((batch_idx, batch['cls'].view(-1, 1), batch['bboxes']), 1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 75 but got size 0 for tensor number 1 in the list.
PS C:\Users\eaisacr>
Beta Was this translation helpful? Give feedback.
All reactions