问题描述
我正在训练YOLO模型,我的边界框采用以下格式:-x1,y1,x2,y2 => ex(100,100,200,200)我需要将其转换为YOLO格式,例如:X,Y,W,H => 0.436262 0.474010 0.383663 0.178218
I'm training a YOLO model, I have the bounding boxes in this format:-x1, y1, x2, y2 => ex (100, 100, 200, 200)I need to convert it to YOLO format to be something like:-X, Y, W, H => 0.436262 0.474010 0.383663 0.178218
我已经计算出中心点X,Y,高度H和重量W.但是仍然需要如前所述将它们转换为浮点数.
I already calculated the center point X, Y, the height H, and the weight W.But still need a away to convert them to floating numbers as mentioned.
推荐答案
YOLO规范化了图像空间,使其在x和y方向上都从0扩展到1.要在(x,y)坐标和yolo(u,v)坐标之间转换,您需要将数据转换为u = x/XMAX; y = y/YMAX,其中XMAX,YMAX是您正在使用的图像阵列的最大坐标.
YOLO normalises the image space to run from 0 to 1 in both x and y directions. To convert between you (x,y) coordinates and yolo (u, v) coordinates you need to transform your data as u = x/XMAX ; y= y/YMAX where XMAX, YMAX are the maximum coordinates for the image array you are using.
这全部取决于以相同方式定向图像阵列.
This all depends on the image arrays being oriented the same way.
这篇关于如何将边界框(x1,y1,x2,y2)转换为YOLO样式(X,Y,W,H)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!