pjreddie / darknet

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

YOLOv3, incrementally adding classes #737

Open sferaud opened 6 years ago

sferaud commented 6 years ago

Hi guys,

So.. I have successfully trained a model based on the yolov3.cfg config file to recognize my face. Now i want to explore the case in which i keep adding new faces for facial ID. Ideally, i want to keep adding faces and train over the previous weights, ie, train only the new face If i have to train all classes every time a new face is added, i need to find some other tool for my project, for it would be too time consuming, as training N classes from scratch would take N*2000 iterations, versus the 2000 iterations per new class if i can add the classes incrementally

I have 2000+ annotated images per class. First, I train with just one face. I run 2000 iterations and all is well. I save the weights. Next i change the number of classes and filters to add the new class (so now classes=2, filters=18) in all instances of the yolo layer and previous convolutionals in the cfg file, and put stopbackward=1 before the last convolutional layer before every yolo layer (so stopbackward=1 is present in 3 different lines in the cfg file) I add the new images to the train.txt file, and make the appropriate changes to my .data and .names files. All labeled images from the class im trying to incorporate begin with 1.

I continue training passing the weights saved from the previous training, and after 2000 iterations, all is wrong. Nor the new class neither the old one is picked up by the detector. Is something wrong with my setup? Is there another way to do this?

Thanks in advance. Help is appreciated!

SmitSheth commented 6 years ago

@sferaud did you find solution to above problem?

surajitkundu29 commented 6 years ago

https://github.com/AlexeyAB/darknet/issues/1332