常见的目标检测bbox标注格式

Pascal VOC

bbox:[x_min, y_min, x_max, y_max]

格式:左上右下

COCO

bbox:[x_min, ymin, width, height]

格式:左上宽高

YOLO

bbox [x_center, y_center, width, height]

并进行数据规范化(normalized)

格式:中心坐标,宽高

YOLO转COCO

python 复制代码
def xywhn2xyxy(x, w=640, h=640, padw=0, padh=0):
    y = x.clone() if isinstance(x, torch.Tensor) else np.copy(x)
    y[:, 0] = w * (x[:, 0] - x[:, 2] / 2) + padw  # top left x
    y[:, 1] = h * (x[:, 1] - x[:, 3] / 2) + padh  # top left y
    y[:, 2] = w * (x[:, 0] + x[:, 2] / 2) + padw  # bottom right x
    y[:, 3] = h * (x[:, 1] + x[:, 3] / 2) + padh  # bottom right y
    return y

COCO 转 YOLO

python 复制代码
 def convert_box(size, box):
        # Convert COCO box to YOLO xywh box
        dw = 1. / size[0]
        dh = 1. / size[1]

        return (box[0] + box[2] / 2) * dw, (box[1] + box[3] / 2) * dh, box[2] * dw, box[3] * dh

Pasic VOC 转 YOLO

python 复制代码
def convert_box(size, box):
        # Convert VOC box to YOLO xywh box
        dw = 1. / size[0]
        dh = 1. / size[1]

        return ((box[0] + box[1]) / 2.0 * dw, (box[2] + box[3]) / 2.0 * dh , (box[1] - box[0]) * dw, (box[3] - box[2]) * * dh)
相关推荐
ZC跨境爬虫几秒前
dankoe视频笔记:如何培养对自己喜欢之事的痴迷感
人工智能·笔记·搜索引擎
追风少年ii1 分钟前
HD文献分享(正刊)--结肠炎的表观遗传记忆促进肿瘤生长
人工智能
西陵2 分钟前
别再写 Prompt 了Spec Mode 才是下一代 AI 编程范式
前端·人工智能·ai编程
冰西瓜6006 分钟前
深度学习的数学原理(二十六)—— 多头注意力
人工智能·深度学习
子兮、7 分钟前
DotCloudLib点云后处理算法库首次开源!
人工智能·算法库
AI应用实战 | RE10 分钟前
014、索引高级实战:当单一向量库不够用的时候
数据库·人工智能·langchain
Fzuim11 分钟前
大模型Agent工程化:从“模型至上”到“Harness为王”——2026年趋势研究报告
人工智能·agent·skill·harness
Gavin_ZYX20 分钟前
Skill 管理过于繁琐,不如写个自动同步的工具
人工智能·架构·github
lisw0520 分钟前
《计算机辅助设计与图形学学报》分析评介!
人工智能·机器学习
wanzehongsheng25 分钟前
双轴跟踪系统核心优势解析:助力光伏电站提质增效的关键技术
人工智能·光伏·智能光伏·光伏支架·光伏追踪支架·光伏跟踪支架