AlexeyAB / darknet

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

Issues in getting full mAP while training #3142

Open marcozov opened 5 years ago

marcozov commented 5 years ago

Hi,

I am currently trying to train the model with the COCO dataset. In particular, I am using a modified version of the 2017 splits, which maintains the defined proportion (118k in the train split, 5k in the validation split), but it changes some of the elements inside each split (some of the images of the original COCO train split are moved in the validation and viceversa). Clearly, I have also defined new annotation/labels files, consistent with these new splits. I start the training by initializing the weights with imaginet: ./darknet_gpu detector train cfg/coco.data cfg/yolov3.cfg darknet53.conv.74

I have this issue: the training proceeded reasonably smoothly (although a bit slow) and I managed to get around 49% mAP on the validation set (obtained through the ./darknet_gpu detector map cfg/coco.data cfg/yolov3.cfg yolov3_108000.weights command). While this is not bad, I would like to achieve something closer to the accuracy obtained in the paper (around 57%). After some iterations (around 108k), the mAP starts decreasing. Any idea why this is happening? Should I try to change some parameter?

The configuration files that I am using are attached (I renamed them with .txt extension): I did not really change anything, besides coco.data for specifying my own directories and the batch/subdivisions fields in cfg/yolov3.cfg, because I was having some memory issues with the default values.

Thank you very much in advance, any help will be appreciated. coco.data.txt yolov3.cfg.txt

AlexeyAB commented 5 years ago

@marcozov Hi,

To get mAP ~57% you should train with random=1 or 608x608 and check mAP with width=608 height=608

It is tested on test-dev instead of validation dataset.

You can reduce learning rate and continue training, it should improve accuracy.


Also if you just want to get higher mAP, you can try to train yolov3-spp.cfg instead of yolov3.cfg

marcozov commented 5 years ago

Thanks a lot for your reply! Where, exactly, should I put "random=1" and 608x608? Still inside yolov3.cfg? I think random=1 is already used. And 608x608 still refers to width and height, right? I am using the same cfg file for training and test, I just change the batch and subdivisions parameters.

AlexeyAB commented 5 years ago

Use during Training either

  1. random=1 width=416 height=416
  2. random=0 width=608 height=608

Use during Detection width=608 height=608

wuhy08 commented 5 years ago

Hi @AlexeyAB

I wonder what random=1 do in the code?

AlexeyAB commented 5 years ago

https://github.com/AlexeyAB/darknet/wiki/CFG-Parameters-in-the-different-layers

random=1 - randomly resizes network for each 10 iterations from 1/1.4 to 1.4(data augmentation parameter is used only from the last layer)