AlexeyAB / darknet

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

How do you do transfer learning based on the models from the model zoo? #7254

Open devedse opened 3 years ago

devedse commented 3 years ago

I found the model zoo useful because I want to start training a model on my 3080. I decided that the YOLOv4-Mish-416 would probably fit fine.

For the normal yolov4.weights there's also a yolov4.conv.137 available. I can't find a similar file to the YOLOv4-Mish-416 file though. Is there a way to generate this file yourself or obtain it somewhere else?

Next to that, another related question: I saw Scaled-YoloV4 also being mentioned a lot of times. Are the models from the model zoo actually using YoloV4 scaled or not?

AlexeyAB commented 3 years ago

Look at these examples how to generate your own pre-traineed weights like yolov4.conv.137 from yolov4.weights https://github.com/AlexeyAB/darknet/blob/master/build/darknet/x64/partial.cmd

devedse commented 3 years ago

So how do you know what that last number is? E.g. 137 for yolov4, but what is it for leaky or Mish?

AlexeyAB commented 3 years ago

Use the number of layer prior to the first [yolo] layer.

devedse commented 3 years ago

Hmm, I tried this on the yolov4.cfg. I'm not experienced with darknet as of yet so I assume that everything in between brackets ([...]) is a layer. I counted all instances of that and came to a total of 140.

I assume the first one [net] shouldn't be counted but that still results in a count of 139. Which is 2 more then expected.

I counted everything up until the red line (the first yolo layer)

image

devedse commented 3 years ago

From what I read regarding scaled YOLO it seems that the CSP model might actually be one of the better ones.

However I don't think the scaled models are described in the model zoo?: https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo

Or am I misunderstanding some things?

AlexeyAB commented 3 years ago

Yes, YOLOv4-CSP it the best (but not for small objects): https://github.com/AlexeyAB/darknet/issues/7087#issuecomment-750924784

CSP model is described there: https://github.com/AlexeyAB/darknet/issues/7087

And there: https://alexeyab84.medium.com/scaled-yolo-v4-is-the-best-neural-network-for-object-detection-on-ms-coco-dataset-39dfa22fa982?source=friends_link&sk=c8553bfed861b1a7932f739d26f487c8

1_epe7z6IqRuzOvPmTc00tpQ (1)


To get layer number just run detection on any image: image

devedse commented 3 years ago

chart_yolov4-csp-obj

@AlexeyAB , i have been training for about 24 hours and this is the result. Is this to be expected?