Darknet: Model pre-processing parameters

Created on 30 Aug 2017  路  10Comments  路  Source: AlexeyAB/darknet

Hello,

As we know in the CFG file, there are some pre-processing parameters:

channels=3
momentum=0.9
decay=0.0005
angle=0
saturation = 1.5
exposure = 1.5
hue=.1

in my case, the target object might rotate frequently in angle, therefore defining the angle as for example angle=180 might help to make a stronger model, but it shows no increase in accuracy after training, which it should naturally. Why?

Most helpful comment

@VanitarNordic Hi,

load_data_detection()-function doesn't use angle-parameter: https://github.com/AlexeyAB/darknet/blob/9e23ff2523713123daea5ff78fa93737cae349c6/src/data.c#L664

Angle used only in load_data_augment() and load_data_tag(). So to use angle we should change source code. But Pascal VOC and MS COCO datasets doesn't require rotation invariant detection, so angle can't give any advantage. Angle can give advantage only for example for satellite images.

All 10 comments

@VanitarNordic Hi,

load_data_detection()-function doesn't use angle-parameter: https://github.com/AlexeyAB/darknet/blob/9e23ff2523713123daea5ff78fa93737cae349c6/src/data.c#L664

Angle used only in load_data_augment() and load_data_tag(). So to use angle we should change source code. But Pascal VOC and MS COCO datasets doesn't require rotation invariant detection, so angle can't give any advantage. Angle can give advantage only for example for satellite images.

Thank you.

You are right about VOC Dataset, but there are many examples that Angle matters and target objects may have variation of angles either.

Also there are other parameters which might be helpful such as shift and flip

Yes, there is flip, but what is a shift?


There are 3 steps of data augumentation:

  1. crop_image() and resize_image() - crop random rectangle - this makes it possible to detect objects of different sizes and with different aspect ratios: https://github.com/AlexeyAB/darknet/blob/9e23ff2523713123daea5ff78fa93737cae349c6/src/data.c#L697
    using param jitter= https://github.com/AlexeyAB/darknet/blob/9e23ff2523713123daea5ff78fa93737cae349c6/cfg/yolo-voc.2.0.cfg#L234

  2. if(flip) flip_image(sized); - randomly image flip (flip or not), but you should comment this line, for example, if you want to detect arrows on road signs - i.e. left-arrow and right-arrow should be different objects. But flip_image will make these 2 objects the same one: https://github.com/AlexeyAB/darknet/blob/9e23ff2523713123daea5ff78fa93737cae349c6/src/data.c#L703

  3. random_distort_image(sized, hue, saturation, exposure); - randomly change colours in HSV: https://en.wikipedia.org/wiki/HSL_and_HSV
    Allows Yolo to detect objects in different lighting, or even regardless of color, depends on these 3 params: https://github.com/AlexeyAB/darknet/blob/9e23ff2523713123daea5ff78fa93737cae349c6/cfg/yolo-voc.2.0.cfg#L10

Yes, there is flip, but what is a shift?

it seems it was one of the parameters in YOLO V1

https://github.com/frankzhangrui/Darknet-Yolo/blob/master/cfg/strided.cfg#L24

1) Therefore we can not include the angle as easy as that and we should modify the code heavily?

2) Also the [crop] layer has been removed in YOLO v2. if I include I will face no error, but why it has removed?

  1. You can read this: https://groups.google.com/forum/#!searchin/darknet/angle|sort:relevance/darknet/DPxhZcC0x2k/LkJuxIb6AAAJ
  2. Because now crop hardcoded in load_data_detection(), i.e. crop used always and denepnds on jitter param in cfg file

Thank you.

I did not understand how he rotates in 90 degrees. Do you know in which part of the code this 90 degree is being calculated?

I suggest you to add this feature as you repo outperforms the original Darknet already and this feature will make it more unique. His code has some problems and I face some errors.

  1. image orig = rotate_image_r(orig0, TWO_PI/4); in his code, TWO_PI/4 in rads = 90 in degrees: https://groups.google.com/d/msg/darknet/DPxhZcC0x2k/d8HtdYDxAwAJ

  2. Maybe I'll add as there will be time.

I got some errors with his code which I could not solve them. Maybe for you would be a peace of cake.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mididou picture Mididou  路  3Comments

kebundsc picture kebundsc  路  3Comments

louisondumont picture louisondumont  路  3Comments

Cipusha picture Cipusha  路  3Comments

hemp110 picture hemp110  路  3Comments