【问题标题】:How to convert Bounding Box coordinates to Yolo Coordinates with Python?如何使用 Python 将边界框坐标转换为 Yolo 坐标?
【发布时间】:2021-09-03 03:14:03
【问题描述】:

我需要转换坐标。我有这种格式<left> <top> <width> <height> 我需要这种格式的x_center y_center width height。我该怎么做?

【问题讨论】:

    标签: python pytorch yolo yolov5


    【解决方案1】:

    中心只是边界框的中间。因此,只需将边界框宽度或高度的一半添加到您的左上角坐标。宽度和高度保持不变

    x_center = left + width / 2
    y_center = top + height / 2
    

    【讨论】:

    • 如果我想标准化坐标 x_center = (left + w/2) / w_img y_center = (top + h/2) / h_img w = w / w_img h = h / h_img 对吗?
    猜你喜欢
    • 2021-08-01
    • 2021-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-27
    • 2019-06-18
    • 2022-12-28
    相关资源
    最近更新 更多