I faced YOLOv5 deep-learning Class Error. Somebody have a good Solution?

794 Views Asked by At

I faced an error in yolov5:

AssertionError: Label class 39 exceeds nc=5 in ./data/data.yaml. Possible class labels are 0-4

I think the problem with this is that the class of data.yaml is limited to 5 classes instead of 80, in order to download the coco-data set and learn only a specific class.

Does anyone have a way or code to eliminate items other than a specific label (0-4) when learning labeled data?

1

There are 1 best solutions below

2
On

It seems that your some labels have classId exceed to 5. Check your label files for every image, some of the class id will be 39, fix it. Then it will works fine.

For more details, check this answer too. AssertionError: Label class 15 exceeds nc=1 in data/coco128.yaml. Possible class labels are 0-0