Darknet: How to use angle=... in YOLO .cfg files

Created on 4 Jan 2020  路  2Comments  路  Source: AlexeyAB/darknet

Looking into the angle=... command in the .cfg files. I assume this is for data augmentation. The wiki at https://github.com/AlexeyAB/darknet/wiki/CFG-Parameters-in-the-%5Bnet%5D-section says:

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

Can you add a note to explain is this a boolean on|off value, where angle=0 or angle=1? Or is this in degrees, where angle=22.5 for example would mean darknet can rotate the image +/- 22.5 degrees?

Is there a reason this defaults to zero in the YOLOv3 .cfg files?

want enhancement

Most helpful comment

Found part of the answer. I see this in parser.c:

net->angle = option_find_float_quiet(options, "angle", 0);

So looks like angle is a float, not a boolean flag. And then in random_augment_image(), I see this:

float rad = rand_uniform(-angle, angle) * 2.0 * M_PI / 360.;

So the angles are in degrees.

But...it looks like the rotation is not applied to the image markup? I'll be the first to admit I'm not familiar with the codebase, so maybe I'm looking in the wrong place. Once I mark up my images for training, if those marks are towards the outside edge of the image versus the exact center, then applying a random rotation to the image will cause the marks and the image to be out of sync.

Is this why it defaults to zero in the .cfg file?

All 2 comments

Found part of the answer. I see this in parser.c:

net->angle = option_find_float_quiet(options, "angle", 0);

So looks like angle is a float, not a boolean flag. And then in random_augment_image(), I see this:

float rad = rand_uniform(-angle, angle) * 2.0 * M_PI / 360.;

So the angles are in degrees.

But...it looks like the rotation is not applied to the image markup? I'll be the first to admit I'm not familiar with the codebase, so maybe I'm looking in the wrong place. Once I mark up my images for training, if those marks are towards the outside edge of the image versus the exact center, then applying a random rotation to the image will cause the marks and the image to be out of sync.

Is this why it defaults to zero in the .cfg file?

Rotation-data-augmentation isn't implemented yet for Detector.

It is implemented only for Classifier currently.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hemp110 picture hemp110  路  3Comments

zihaozhang9 picture zihaozhang9  路  3Comments

HilmiK picture HilmiK  路  3Comments

Yumin-Sun-00 picture Yumin-Sun-00  路  3Comments

yongcong1415 picture yongcong1415  路  3Comments