常见的目标检测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)
相关推荐
咏&志3 分钟前
目标检测Faster-RCNN论文简读
人工智能·目标检测·计算机视觉
研究点啥好呢4 分钟前
3月28日Github热榜推荐 | 你还没有为AI接一个数据库吗
数据库·人工智能·驱动开发·github
财迅通Ai5 分钟前
探路者旗下通途半导体推出人工智能全栈压缩技术 撬动万亿级端侧人工智能市场
人工智能·探路者
cxr8285 分钟前
OpenClaw Node 行业实践案例
人工智能·ai智能体·openclaw
不一样的故事1266 分钟前
测试的核心本质是风险管控
大数据·网络·人工智能·安全
禁默8 分钟前
从零吃透大语言模型 LLM,AI 应用开发必懂底层逻辑
人工智能·机器学习·语言模型·大模型
童话名剑11 分钟前
YOLO v6(学习笔记)
yolo·目标检测·yolov6
空空潍12 分钟前
Spring AI 实战系列(二):ChatClient封装,告别大模型开发样板代码
java·人工智能·spring
张较瘦_12 分钟前
[论文阅读] AI + 软件工程 | 从1对1到规模化,Lacy用AI+专家代码漫游重构软件入职指导
人工智能·重构·软件工程
卖报的大地主22 分钟前
视觉生成底层技术发展脉络与研究图谱
人工智能·深度学习·计算机视觉