AlexeyAB / darknet

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

Transfer Learning/ Fine Tuning for YOLOv3 or YOLOv4 and testing #6652

Open Hishok opened 4 years ago

Hishok commented 4 years ago

Hi,

I am trying to train a YOLOv4. I have create a base model and would like to make changes such as add more images for training such as augmentations to see if any improvements would be made on the mAP. Would you perform fine tuning or transfer learning?

@AlexeyAB How would you perform transfer learning on the YOLOv4 network? Would you use stopbackward = 1 ? Also would you use the partial function (darknet.exe partial cfg/yolov4-tiny-custom.cfg yolov4-tiny.weights yolov4-tiny.conv.29 29). For this example does this mean the first 29 layers of the tiny yolov4 network are frozen? For YOLOv4 would you only freeze layers just before the three detection points at 139,150 and 161?

I am using the yolov4-custom.cfg file

I am using Google Colab Pro and I am not fond of retraining the whole network which is why I am considering transfer learning.

Separate Question: how would you test the whole test dataset, would you follow a similar way to evaluating the validation dataset?

Thanks,

Hisho

2139

LukeAI commented 4 years ago

have you read this?

Would you perform fine tuning or transfer learning?

in general fine tuning will give you worse results, in less time than allowing backpropagation through the whole network. - either way, you are probably "transfer learning" in the sense of using pretrained weights from coco as a starting point. if you want best results it's probably better to not use stopbackward.

don't really understand your other questions.

Hishok commented 4 years ago

thank you for your comment. I have read the link you posted.

@LukeAI I have run a base model and now I want to feed in more images to the training data (negatives, manual augmentation), would this mean I carry on training and increase the max_batches or would I do Transfer Learning and use the partial function?

@AlexeyAB

LukeAI commented 4 years ago

I would just train you model with everything from the start. but if you really don't want to do that then I can't see why there'd be a need to use the partial function - it's the same except you'll lose some information in the layers after the first yolo layer.

Hishok commented 4 years ago

What weights file would I use to train the model from the start? When I use my last weights file created from the base model the training finishes quickly. Would I need to use the -clear flag?

Could you explain what the partial function does please? @LukeAI

Diaislam commented 2 years ago

I would just train you model with everything from the start. but if you really don't want to do that then I can't see why there'd be a need to use the partial function - it's the same except you'll lose some information in the layers after the first yolo layer.

it really matters when you have an mlops pipeline that's getting feedback from the model mistakes , in that case training the whole dataset each week is so much a burden, is there anyway to feed the model only new images to update the weights , training a big dataset is so much time expensive