将 OpenImage 坐标转换为 DarkNet 格式

Convert OpenImage Coordinates to DarkNet format

如何将屏幕 space 坐标转换为 DarkNet Yolo 格式?

图片尺寸:

width: 1024
height: 768

盒子尺寸:

x: 51.84
y: 175.359741
width: 988.16
height: 639.999756

归一化我理解点到图像的划分,因为 x = x/width 但要将 x,y,width,height 坐标转换为暗网格式。

如果有人能指出我的 C# 方向

btw 暗网格式叫什么?,因为原来是screen-space。 这将使谷歌搜索变得容易得多。

This 可能会有帮助。 YOLO格式为:

<object-class> <x_center> <y_center> <width> <height>

其中所有<x_center> , <y_center> , <width> , <height>都是相对于图像宽度和高度的浮点值,它可以等于0.0到1.0。

  • width = 对象的宽度/图像的宽度
  • 高度=物体高度/图像高度
  • x_center和y_center是每个物体的圆心坐标

例如计算中心:

  • x_center = (x_min + (x_max - x_min)/2) / image_width
  • y_center = (y_min + (y_max - y_min)/2) / image_width

在你的例子中:

width = 988.16 / 1024
height = 639.999756 / 768
x_center = (51.84 + 988.16) / (2 * 1024)
y_center = (175.359741 + 639.999756) / (2 * 768)

我不确定你的文本文件是什么样子的。如果您可以 post 将您的文本文件示例 read 转换为 read ,将会有所帮助。 我也不知道暗网格式叫什么