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

Fine-tuning YOLOv4 using darknet framework #8723

Open Avv22 opened 1 year ago

Avv22 commented 1 year ago

I would like to fine-tune a YOLOv4 pre-trained model on a new dataset that has only 1 class I would like YOLOv4 to be able to detect, which is ambulance vehicle.

The first step is to find a pre-trained model with weights based on the darknet framework:

https://github.com/AlexeyAB/darknet#pre-trained-models

Second, fine-tune the pre-trained model in the link above on the new dataset that has only one class. But I am not sure if I can do that on the darknet, please. In PyTorch, it's not difficult, but I would like to see if I can fine-tune a pre-trained model in the darknet framework.

Also, if I fine-tune the model on 1 object, I will lose the ability to detect other objects I guess? How to avoid that please as I would like to still have the pre-trained YOLOv4 be able to detect the classes it was trained on before.

stephanecharette commented 1 year ago

That's not how darknet works.

You'll have to download the entire dataset (for example, MSCOCO), make the modifications you need, and then retrain.

Avv22 commented 1 year ago

@stephanecharette . Thank you. I can not use a pre-trained model and extend it on my new dataset.