WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.36k stars 4.22k forks source link

AssertionError: train: No labels in /content/yolov7/SKU110K_fixed/annotations/train_list.cache. Can not train without labels. See https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data #1435

Open Maioy97 opened 1 year ago

Maioy97 commented 1 year ago

Hello I'm trying to use the train.py yo train a model for the second time the code doesn't see my labels the labels are organised next to the images and I did confirm that all the labels are there it gives me this error :

AssertionError: train: No labels in /content/yolov7/dataset/annotations/train_list.cache. Can not train without labels. See https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data

I believe it might be related to the train.txt having a \n at the end of each line but i made sure there's only 1 \n this same code that generates the labels was used for a model I trained a month ago the list file looks like

" /content/yolov7/dataset/images/train_0.jpg /content/yolov7/dataset/images/train_1.jpg /content/yolov7/dataset/images/train_10.jpg /content/yolov7/dataset/images/train_100.jpg

. . . . "

here's an example of the image list before it went in the file

['/content/yolov7/dataset/images/train_0.jpg\n',
 '/content/yolov7/dataset/images/train_1.jpg\n',
 '/content/yolov7/dataset/images/train_10.jpg\n',
 '/content/yolov7/dataset/images/train_100.jpg\n',
.
.
.
.
]

I tried it without the \n, everything was in the same line and the labels themselves are in the yolo format

15738281321 commented 11 months ago

@Maioy97 你解决这个问题了吗?我现在也是这个但是不知道怎么解决

linlion0311 commented 5 months ago

I encountered the same issue, but I found that YOLOv7 automatically generates a labels.cache file. I training by deleting it first. Btw, I only placed the images and labels in the same folder without adding an additional labels.txt. FYR