AlexeyAB / darknet

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

Two classes same banding box #7357

Open ridams opened 3 years ago

ridams commented 3 years ago

Some one knows if it is correct to label The same banding box for two classes ; example : I want to detect car and its color in one shot, so The same banding box will take the class label car and a color red for example

Maxwell2Gyamfi commented 3 years ago

You can, the concept of inheritance works in object detection too. This means an object can belong to multiple classes. Cat and dog both belong to animal class. The only issues you might have is the model might predict a blue car as a red car? Why don't you have a separate class for red cars? And since you're trying to detect red colour, you might as well train to model to detect red. You don't need a huge amount to training dataset since it's just color. Just remember to disable color augmentation in your cfg

ridams commented 3 years ago

Thanks for the quick reply, It is just to be able to run in a resources limited system, I know I can train another yolo for colors, but I should run predictions two times, first detect car using standard yolo, second run predictions of color for every detected car, I the first step returns 10 cars, so it will be very slow; I've already trained yolo successfully to detect cars and their license plates in a single shot, but that one seems different. exactly the same banding box!

Maxwell2Gyamfi commented 3 years ago

Option 1: You can train a single YOLO model and have classes Car, red car, blue car etc. YOLO prediction will return: car, red car or blue car

Option 2: you can train a single YOLO model and have classes Car, red, blue etc. If car is red, YOLO prediction will return car, red on same bounding box

You don't need to train to different YOLO models

ridams commented 3 years ago

Thanks, Option two is great, when it predicts car and red I can check if for example the center of each box is inside the other box so It means a red car.

shubham-shahh commented 3 years ago

Some one knows if it is correct to label The same banding box for two classes ; example : I want to detect car and its color in one shot, so The same banding box will take the class label car and a color red for example

if you are planning to make 2 classifiers you can use back to back detectors in a deepstream pipeline namely pgie and sgie