首页 > 解决方案 > Convert OpenImage Coordinates to DarkNet format

问题描述

How can i Converting Screen space Coordinates to DarkNet Yolo format?

Image Dimensions:

width: 1024
height: 768

Box Dimensions:

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

Normalization i understand with the division of point to image, as x = x/width but to convert the x,y,width,height coordination to darknet format.

if anyone can point me in a c# direction

btw what is the darknet format called?, since the original is screen-space. that would make googling a lot easier.

标签: c#.netyolo

解决方案


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

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

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

  • 宽度 = 对象宽度 / 图像宽度
  • 高度 = 物体高度 / 图像高度
  • 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)

我不确定你的文本文件是什么样子的。如果您可以发布一个文本文件示例以供阅读和转换,这将有所帮助。我也不知道暗网格式叫什么。


推荐阅读