Wrong annotation: class_id = 1. But class_id should be [from 0 to 0], file: data/obj/20210221_112744.txt

Viewed 3521

I am using Yolo to train custom object detection while training i am getting following error

   Wrong annotation: class_id = 1. But class_id should be [from 0 to 0], file: data/obj/20210221_112732.txt 
2 Answers

Here's a review of the YOLO label format:

<class id> <Xo/X> <Yo/Y> <W/X> <H/Y>

Where:

<class id>, label index of the class, integer object number from 0 to (classes-1)

<Xo/X> coordinate of the bounding box’s center

<Yo/Y> coordinate of the bounding box’s center

W, Width of the bounding box

H, Height of the bounding box

X, Width of the image

Y, Height of the image

It seems like you have put classes=1 in your data file. That means your class id should be 0 in the labels. Edit the class id in your labels to 0.

it seems you have 1 class so the class id become 0. if you have more than 1 classes, the class id should be 0 to 1. the solution, you can add this:

classes = 2 in cfg, .data, and .names file, so you must change the filters, steps, max_batches in cfg files

it works for me

Related