YOLOv4 annotations saves dimensions in a [0,1] float

Viewed 3154

This is from an annotations file for an image:

0 0.6142131979695431 0.336 0.467005076142132 0.392

The first zero is the class label. 0.6142131979695431 and 0.336 are the xy coordinates of the bounding box. 0.467005076142132 and 0.392 are the width and the height of the bounding box. However, what I don't get is why the x, y, width and height are in a [0,1] float. Someone told me that its a percentage but a percentage relative to what?

For example. I am writing software that builds a synthetic dataset. This is one training image I produced. It has the bounding boxes around the objects I want to detect.

enter image description here

The bounding boxes wrap the Wizards and Ubuntu logos perfectly. So how can I annotate them like the format above?

1 Answers

They width/height in yolo format are the fraction of total width/height of (entire image). So the top-left corner is always (0,0) and bottom-right corner is always (1,1) irrespective of size of image.

See this question for the conversion of bounding box (x1, y1, x2, y2) to YOLO Style (X, Y, W, H)

enter image description here

Related