AlexeyAB / darknet

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

How to select the method of data augmentation? #6125

Open huizhang2017 opened 4 years ago

huizhang2017 commented 4 years ago

@AlexeyAB , Hi... Could you please explain several parameters in the yolov4-custom.cfg? Such as: (1) scales=.1,.1, what does the two '.1' mean? Scare for the height and width with +/- 10%? Or ....? (2) burn_in = 1000, what does this parameter mean? (3) angle =0, rotate the image? If I set angle=15, what does it mean? Rotate the image left or right in 15 degrees?

In fact, I want to only use several simple methods of data augmentation, such as flip, change the pixel value for some pixels, add gaussian noise, but I especially do not want to scale the image, because some regions near the image edge is important, I don't want to loss the information near the edge.

So how to select the methods of data augmentation? I only need to revise the yolov4-custom.cfg file?

I am looking forward to your reply , Thank you very much.

stephanecharette commented 4 years ago

I don't have answers to all your questions, but a few of your questions are answered here: https://www.ccoderun.ca/darkmark/DataAugmentation.html

AlexeyAB commented 4 years ago

Read: https://github.com/AlexeyAB/darknet/wiki/CFG-Parameters-in-the-%5Bnet%5D-section

huizhang2017 commented 4 years ago

I don't have answers to all your questions, but a few of your questions are answered here: https://www.ccoderun.ca/darkmark/DataAugmentation.html

Thank you very much!

huizhang2017 commented 4 years ago

Read: https://github.com/AlexeyAB/darknet/wiki/CFG-Parameters-in-the-%5Bnet%5D-section

Thank you very much.

yiwenwan2008 commented 4 years ago

@AlexeyAB For detection does the image augmentation apply scaling and cropping? If yes, may i know where to set the parameters. If no, may I know why?

Thank you for the great work.

yiwenwan2008 commented 4 years ago

I think I may have found it...in yolo layer...jitter and scale- randomly changes size of image and its aspect ratio from x(1 - 2jitter) to x(1 + 2jitter)

AlexeyAB commented 4 years ago

https://github.com/AlexeyAB/darknet/wiki/CFG-Parameters-in-the-%5Bnet%5D-section

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

chrisrapson commented 4 years ago

Edit: I found the answer to my specific follow-up question in issue #4626. Rotation is only implemented for classification at this stage, not object detection. It is already listed as 'want enhancement'.

Hi Alexey,

could you please explain this line on that wiki page:

angle=0 - randomly rotates images during training (classification only)

I don't understand why angle would only apply to classification, or really what "classification" means in the context of an object detector like YOLO. I noticed that your example config files use angle=0. Does that mean that you recommend keeping that setting based on your testing? I was previously under the impression that random rotation was a valuable data augmentation technique.

(P.S. I think this fits well here as a follow up question, but I can make it a separate issue if Alexey or huizhang prefers.)

rafcy commented 4 years ago

Edit: I found the answer to my specific follow-up question in issue #4626. Rotation is only implemented for classification at this stage, not object detection. It is already listed as 'want enhancement'.

Hi Alexey,

could you please explain this line on that wiki page:

angle=0 - randomly rotates images during training (classification only)

I don't understand why angle would only apply to classification, or really what "classification" means in the context of an object detector like YOLO. I noticed that your example config files use angle=0. Does that mean that you recommend keeping that setting based on your testing? I was previously under the impression that random rotation was a valuable data augmentation technique.

(P.S. I think this fits well here as a follow up question, but I can make it a separate issue if Alexey or huizhang prefers.)

Can anyone answer this? Does this means that rotations are not happening during training?

chrisrapson commented 4 years ago

@rafcy I'm pretty sure it hasn't been implemented yet. One of the tricky things with rotating bounding boxes is that they are usually aligned to the image (perfectly horizontal/vertical). If you rotate the image, it's not totally clear how big the new bounding boxes should be. If you have a square bounding box, and rotate it 45°, you might end up with a new bounding box that is 1.41x taller and wider than the original. If the true shape of the object was a circle, that would be wrong because the new bounding box shouldn't change size.

Seeing as this is an open source project, you could always try implementing it yourself and make a pull request.

stephanecharette commented 4 years ago

...but having said that, you can easily rotate 90, 180, and 270 degrees without having to deal with the bounding boxes. DarkMark allows exactly that: https://www.ccoderun.ca/darkmark/DataAugmentationRotation.html