Broken Dataset

I was working with my dataset, adding and removing classes. Now when I exporting it and tryint to train my model with it im getting error AssertionError: Label class 23 exceeds nc=11 in data.yaml. Possible class labels are 0-10

Happy to have a look. Is this project on a public workspace you could link me to?

yes, it is public Sign in to Roboflow

Assuming this is with YOLOv5 due to the data.yaml, in the error message. Let me know if that’s not correct.

I had a look at the dataset and I don’t see any annotations that reference a class 23. Could you give more info about how you’re trying to train? My best guess is that your data.yaml (which defines your classes) is in the right spot but that it’s trying to train with a different dataset that has different images/annotations.

Are you following a specific tutorial?

Yes, it is yolov5. Thats the problem. data.yaml and all images/annotation is generated with roboflow. This is how I train: I download dataset via roboflow control panel and unzip it in to clean yolov5/data folder and then run train with command “python --img 1088 --batch 4 --epochs 1000 --data data.yaml --weights”. My first version of dataset is working just fine but after few iteration of dataset, training got really weird with totally wrong results, and now my last version of dataset is throwing AssertionError

It sounds like data from your different versions might have gotten all jumbled up; try with a fresh directory.

Directory in yolov5/data is always fresh. I believe roboflow generate dataset in a jumbled up way

I figured it out. For some reasone it was trying to use traning data that was in a disc root directory and not in a yolov5 folder

Glad to hear it. I was going to try in our YOLOv5 collab later today to verify the problem wasn’t with the dataset but you beat me to it.

How did you update it to look in the right spot?

I have edited yaml file and specified exact directories for train and val

Could you post the before/after of the yaml to help others who might run into this?



train: ../train/images
val: ../valid/images


train: D:/yolov5-master/data/train/images
val: D:/yolov5-master/data/valid/images
1 Like