AlexeyAB / darknet

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

Multiclass detection? #45

Closed wurstcase closed 7 years ago

wurstcase commented 7 years ago

Just a quick question about multiclass detection. Can i make for example 3 classes where 1 class combines images of the two other classes so that i get a specialized detection ? Like for example make a class car with photos of cars and 2 specialized classes with Lamborghini and Ferari so that my output would be something like: 90% car 75% Lamborghini with practically nearly identical bounding boxes. Is this possible and is this the way you qould do something like that ?

AlexeyAB commented 7 years ago

I didn't do that.

But you can do it by using 2 ways:

  1. Detect and do Hierarchical classification by using Yolo 9000 - page 6: https://arxiv.org/pdf/1612.08242v1.pdf

  2. Or you can use Yolo v2, and you should change function draw_detections(): https://github.com/AlexeyAB/darknet/blob/71a9929af6c3d3ffb9527bb921c5cc4a20971ff6/src/image.c#L180

    • int class = max_index(probs[i], classes); this line get 1 object with maximum probs[i] - porbability of object (confidence): https://github.com/AlexeyAB/darknet/blob/71a9929af6c3d3ffb9527bb921c5cc4a20971ff6/src/image.c#L185

    • Instead of this - You should change implementation of function draw_detections() to draw both class and subclass. Yolo v2 has no concepts such as class and subclass - you should implement it by yourself. To draw call with highes porb and then draw subclass (with highest prob) of this class.

wurstcase commented 7 years ago

Thank you Alexey for the quick response and input on this matter. I think i gonna try yolo9000 and see if this works out otherwise there is still option 2 :)

csaimd commented 7 years ago

Hi,Alexey!I hava an very important problem to ask you .I transplanted yolo from linux to windows by myself。The demo and test is good .It can work well.But when I use the yolo train voc data ,the process is normal,and many .weights in my backup folder. The problem is that I use the weights test every image,it cant detect anything.then I make the thresh 0,it also detect nothing ..I use yours darknet,it is good .So I want to know you what code did you change make darknet work well ? My english is poor,so Please forgive me for improper expression

AlexeyAB commented 7 years ago

@csaimd The main fixes for training - is the replacement of rand-functions, you can find it in commits: https://github.com/AlexeyAB/darknet/commits/master

csaimd commented 7 years ago

Thank you Alexey for the quick response.I hava followed your tips to change the rand-function in data.c.Then training the voc data.however the results is terrible because it is the same as the last result.I download the code from the https://github.com/pjreddie/darknet and not change anything.This problem makes me craze!!!!

Sunmyfong commented 7 years ago

@csaimd if you use cudnn, the version of cuda&cudnn should be match.

kmsravindra commented 6 years ago

@AlexeyAB, I am trying to do the same thing as @wurstcase described above using Yolo-v3. I am planning to have 2 classes identifying the same object (for eg., car, Lamborghini - both of them will identify the same bounding box but appear with different class names in the annotation). So my question is while detecting, can I ask the detector to draw the bounding boxes only for cars OR draw them only for Lamborghini's? Is my approach ok?, if so, could you please tell me which part of the code should I change for Yolo-v3 to do this?

AlexeyAB commented 6 years ago

@kmsravindra

For example, if class id for car = 4.


kmsravindra commented 6 years ago

Thank you. I will check this out.