pjreddie / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
25.84k stars 21.33k forks source link

Yolo v3-how to assign multiple labels to the same object in the training dataset? #993

Open Aslizy opened 6 years ago

Aslizy commented 6 years ago

Since the yolo v3, instead of softmax, it starts to use logistic regression, which can handle the case when one object belongs to multiple labels. I wonder when preparing the training dataset, e.g. object-class x y width height, what is the proper/correct format to assign multiple labels/class to the same object?

If my question is still unclear, then in the training txt file, for an object who belongs to multiple labels, there should be some other nicer way than the following format, right? label1 x y width height label2 x_the same y_the same width_the same height_the same

Thanks for your answer!

harsh1405 commented 6 years ago

From what I understood from YOLO v3 paper and the original YOLO paper, the format of Yolo output is [obj_confidence, x_center, y_center, width, height, all_classes]. So if an object belongs to two classes, let's say to the 1st and the 3rd class, of all the 5 classes available, then it can be labelled as [1, x_center, y_center, width, height, 1, 0, 1, 0, 0].

Mrjaggu commented 6 years ago

Hey Harsh, Can you just explain with example if possible..needed more info on it

Mrjaggu commented 6 years ago

From what I understood from YOLO v3 paper and the original YOLO paper, the format of Yolo output is [obj_confidence, x_center, y_center, width, height, all_classes]. So if an object belongs to two classes, let's say to the 1st and the 3rd class, of all the 5 classes available, then it can be labelled as [1, x_center, y_center, width, height, 1, 0, 1, 0, 0].

Hey Harsh, Can you just explain with example if possible..needed more info on it

juiceboxjoe commented 6 years ago

@Mrjaggu The last 5 values in @harsh1405 's answer (1,0,1,0,0) are a one-hot vector where 1 means the object belongs to that class ans 0 o.w.

PhillipHuang2017 commented 5 years ago

From what I understood from YOLO v3 paper and the original YOLO paper, the format of Yolo output is [obj_confidence, x_center, y_center, width, height, all_classes]. So if an object belongs to two classes, let's say to the 1st and the 3rd class, of all the 5 classes available, then it can be labelled as [1, x_center, y_center, width, height, 1, 0, 1, 0, 0].

i think you are right ,but how should I make a label txt file to this

isyanan1024 commented 4 years ago

Since the yolo v3, instead of softmax, it starts to use logistic regression, which can handle the case when one object belongs to multiple labels. I wonder when preparing the training dataset, e.g. object-class x y width height, what is the proper/correct format to assign multiple labels/class to the same object?

If my question is still unclear, then in the training txt file, for an object who belongs to multiple labels, there should be some other nicer way than the following format, right? label1 x y width height label2 x_the same y_the same width_the same height_the same

Thanks for your answer!

Have you solve this problem? How to make a label txt file?

Maioy97 commented 3 years ago

Did anyone find the correct format ? I might need to try each method possible till I find the one that works

Kuz-man commented 3 years ago

Did anyone find the correct format ? I might need to try each method possible till I find the one that works

Check this out: https://www.gitmemory.com/issue/AlexeyAB/darknet/4499/564411821

I was wondering if NMS wouldn't squash different labels but it seems that's not the case.

andyrey commented 3 years ago

@Kuz-man: In my understanding, NMS considers only detections of the same class. Correct me, if I am wrong.

Kuz-man commented 3 years ago

@Kuz-man: In my understanding, NMS considers only detections of the same class. Correct me, if I am wrong.

That should be the case, yes. Still, this is implementation specific and I have not went trough the code in details.