AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.76k stars 7.96k forks source link

how to do training on specific class id ? i have 30 claases & its annotation but i want to train only 10 classes #8072

Open akashAD98 opened 3 years ago

akashAD98 commented 3 years ago

I have 30 classes & my dataset is totally imbalanced, so I'm planning to train only the top 10 classes, But i don't want to remove other class ids from text file, is there any way to do this?? @AlexeyAB @WongKinYiu

i have classes like this

id class 1 oven 2 microwave 3 toaster 14 cell phone

example in each image i have cellphone & i don't want to delete that cellphone class id ,

so i want to train only 3 classes oven,microwave,toster , apart from cellphone.

akashAD98 commented 3 years ago

should i mention only 10 class names in obj.names?

i have done an experiment & I'm getting this warning but training is going on , is there any other way to handle this case??

Wrong annotation: class_id = 21. But class_id should be [from 0 to 2], file: data/obj/Rifle75a4d41b4e944f2e.txt Wrong annotation: class_id = 14. But class_id should be [from 0 to 2], file: data/obj/Rifle628ef7444adb0c6f.txt

lsd1994 commented 3 years ago

You should make a new copy of all your labels and change the class id to 0-9.

akashAD98 commented 3 years ago

@isd1994 yes its fine,but lets say class_id=21 present in 0-9 classes , so should i need to remove them from data? or is there any other way

lsd1994 commented 3 years ago

Just write a script, if id=21, change it to 0, if id=25, change it to 1, and so on. You should only change class id and copy its x,y,w,h.