常见的目标检测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)
相关推荐
董建光d16 小时前
YOLOv4:目标检测的 “速度与精度平衡术
yolo·目标检测·目标跟踪
ASKED_201916 小时前
深度强化学习之123-概念梳理
人工智能
攻城狮7号16 小时前
OpenAI 的 Sora 2来了:一场创意革命与失控的狂欢
人工智能·大模型·openai·ai视频·sora 2
胖头鱼的鱼缸(尹海文)17 小时前
数据库管理-第376期 Oracle AI DB 23.26新特性一览(20251016)
数据库·人工智能·oracle
瑞禧生物ruixibio17 小时前
4-ARM-PEG-Pyrene(2)/Biotin(2),多功能化聚乙二醇修饰荧光标记生物分子的设计与应用探索
arm开发·人工智能
大千AI助手17 小时前
Huber损失函数:稳健回归的智慧之选
人工智能·数据挖掘·回归·损失函数·mse·mae·huber损失函数
墨利昂17 小时前
10.17RNN情感分析实验:加载预训练词向量模块整理
人工智能·rnn·深度学习
【建模先锋】17 小时前
一区直接写!CEEMDAN分解 + Informer-LSTM +XGBoost组合预测模型
人工智能·lstm·ceemdan·预测模型·风速预测·时间序列预测模型
fsnine17 小时前
YOLOv2原理介绍
人工智能·计算机视觉·目标跟踪