常见的目标检测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)
相关推荐
charley.layabox1 小时前
8月1日ChinaJoy酒会 | 游戏出海高端私享局 | 平台 × 发行 × 投资 × 研发精英畅饮畅聊
人工智能·游戏
DFRobot智位机器人2 小时前
AIOT开发选型:行空板 K10 与 M10 适用场景与选型深度解析
人工智能
想成为风筝4 小时前
从零开始学习深度学习—水果分类之PyQt5App
人工智能·深度学习·计算机视觉·pyqt
F_D_Z4 小时前
MMaDA:多模态大型扩散语言模型
人工智能·语言模型·自然语言处理
大知闲闲哟4 小时前
深度学习G2周:人脸图像生成(DCGAN)
人工智能·深度学习
飞哥数智坊4 小时前
Coze实战第15讲:钱都去哪儿了?Coze+飞书搭建自动记账系统
人工智能·coze
wenzhangli74 小时前
低代码引擎核心技术:OneCode常用动作事件速查手册及注解驱动开发详解
人工智能·低代码·云原生
潘达斯奈基~5 小时前
大模型的Temperature、Top-P、Top-K、Greedy Search、Beem Search
人工智能·aigc
倔强青铜三6 小时前
苦练Python第18天:Python异常处理锦囊
人工智能·python·面试
倔强青铜三6 小时前
苦练Python第17天:你必须掌握的Python内置函数
人工智能·python·面试