Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

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

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?

question from:https://stackoverflow.com/questions/65878002/yolov4-annotations-saves-dimensions-in-a-0-1-float

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...