Reputation: 3163
This is from an annotations file for an image:
0 0.6142131979695431 0.336 0.467005076142132 0.392
The first 0
is the class label. 0.6142131979695431
and 0.336
are the x and y 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 understand is why the x, y, width and height are in a [0,1] float interval. Someone told me that it is a percentage, but a percentage relative to what?
For example, I am writing software that builds a synthetic dataset. This is one training image that I have produced. It has the bounding boxes around the objects that I want to detect.
The bounding boxes wrap the Wizards and Ubuntu logos perfectly. So, how can I annotate them like the format above?
Upvotes: 2
Views: 5388
Reputation: 4693
The width/height in YOLO format is the fraction of total width/height of the entire image. So the top-left corner is always (0,0) and bottom-right corner is always (1,1) irrespective of the size of the image.
See this question for the conversion of bounding box (x1, y1, x2, y2) to YOLO style (x, y, w, h).
Upvotes: 6