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

Training with yolov4-p5.cfg on darknet #8603

Open jordan44665 opened 1 year ago

jordan44665 commented 1 year ago

Hi,

I am training the yolov4-p5.cfg with the COCO dataset at resolution 896x896. I am using this command:

darknet detector train cfg/coco.data cfg/yolov4-p5.cfg yolov4-p5.conv.232

The weights file I get does not generate good mAP values (the maximum value I get is 54% after 6000 iterations).

I know Alexey has a weights file that is available on this website (yolov4-p5.weights). I have two questions:

  1. Was this weights file generated using Darknet or PyTorch?
  2. How many iterations were run to generate the weights file?

Thanks.

jordan44665 commented 1 year ago

@AlexeyAB Would you please look at my question above? Thank you.

AlexeyAB commented 1 year ago

@jordan44665

  1. It was trained using Pytorch. Try to use this code: https://github.com/WongKinYiu/ScaledYOLOv4/tree/yolov4-csp
  2. YOLOv4-P5 was trained on Pytorch using 300 epochs, and then finetuned with 150 epochs using stronger data augmentation

https://openaccess.thecvf.com/content/CVPR2021/html/Wang_Scaled-YOLOv4_Scaling_Cross_Stage_Partial_Network_CVPR_2021_paper.html

https://openaccess.thecvf.com/content/CVPR2021/supplemental/Wang_Scaled-YOLOv4_Scaling_Cross_CVPR_2021_supplemental.pdf

image

jordan44665 commented 1 year ago

Thank you. Can I use Darknet to do the training? How would I convert the yolov4-p5.yaml file to yolov4-p5.cfg -- the yolov4-p5.cfg is giving low mAP values and I am suspecting it is not the same as the yolov4-p5.yaml file. I see that you have a comment in the appendix in the paper your referenced about PyTorch having more features that are useful for training. I imagine, that's why I can't use Darknet to train.

Appreciate any guidance you can give on this. @AlexeyAB

jordan44665 commented 1 year ago

@AlexeyAB I saw this footnote in the paper you referenced: "PyTorch training use more advanced techniques, such as exponential moving average, modified decoder, IoU aware, etc."

I know Darknet supports exponential moving average. Is there a list of all the features required to make Darknet also behave like PyTorch (for training).

I will be happy to implement some of these features and create pull requests. I really want to use DN to train yolov4-p5 and get similar mAP values to PyTorch.

Thanks.