常见的目标检测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)
相关推荐
tachibana213 小时前
性能指标的口径选择
数据库·人工智能·架构·大模型·llm
HIT_Weston13 小时前
183、【Agent】【OpenCode】TuiThreadCmd(JS&TS 历史)
人工智能·agent·opencode
蓝狐社13 小时前
你的软件越来越卡,是因为它多了个AI
人工智能
万悉科技13 小时前
AI时代的“搜索战争“变了:从关键词排名到意图匹配,品牌正在大模型的注意力机制里“失声“
人工智能
W_3260013 小时前
Python-OpenCV HSV颜色空间与inRange颜色分割:按颜色提取目标物体
图像处理·人工智能·python·opencv·机器学习
小小测试开发13 小时前
Agent 安全测试:pytest 原生红队框架 RAMPART 实战解析
人工智能·pytest
FunTester13 小时前
DeepSeek Harness 常用插件介绍
人工智能·语言模型·常用插件·deepseek·harness
九硕智慧建筑一体化厂家13 小时前
楼宇自控|智慧建筑核心引擎!楼宇自控系统,赋能建筑高效低碳运维
运维·人工智能·笔记·智慧城市
byte轻骑兵13 小时前
【BlueZ 】蓝牙 SDAP 协议入门:BlueZ 中设备服务发现的基础逻辑
linux·人工智能·bluez·电脑蓝牙·嵌入式蓝牙
老衲の少女心13 小时前
【AI项目】用 LangGraph 构建智能批改与解题系统:条件路由、SSE流式输出Agent工作流实践
人工智能