常见的目标检测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)
相关推荐
Li emily8 小时前
成功接入A股实时行情API获取实时市场数据
人工智能·python·金融·fastapi
China_Yanhy8 小时前
转型AI运维工程师·Day 7:构建“数据飞轮” —— 每一句对话都是资产
运维·人工智能·状态模式
苍何8 小时前
爆肝 2 天,用 GLM5 开发了 OpenClaw 接入微信 bot,已开源!
人工智能
kuankeTech8 小时前
“数改智转”加速跑:外贸ERP助力钢铁智能工厂“提质增效”
大数据·人工智能·经验分享·软件开发·erp
澳鹏Appen8 小时前
澳鹏无锡成功获评国家高新技术企业
人工智能
threerocks8 小时前
前端将死,Agent 永生
前端·人工智能·ai编程
苍何8 小时前
偶然间发现一款逆天的 AI PPT 工具!免费生成!
人工智能
苍何8 小时前
Openclaw + OpenCode 才是 vibe coding 的最棒组合!
人工智能
AI360labs_atyun9 小时前
字节AI双王炸来了!Seedance 2.0 + Seedream 5.0
人工智能·科技·学习·百度·ai
AIMarketing9 小时前
2026 年 GEO 综合实力服务商推荐 行业研究与实践分析
人工智能