常见的目标检测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)
相关推荐
志栋智能5 分钟前
AI驱动的系统自动化巡检:重塑IT基石的智慧“守护神”
大数据·运维·人工智能·云原生·自动化
思通数科人工智能大模型13 分钟前
电力巡检无人机和工程车“空地一体”AI全域巡检方案
人工智能·目标检测·计算机视觉·数据挖掘·无人机·知识图谱·零售
脑海科技实验室20 分钟前
Nature子刊:新研究!人工智能提供更清晰的功能MRI脑数据
人工智能·fmri
qyr678936 分钟前
便携式太阳能折叠板市场白皮书与未来趋势展望
大数据·人工智能·物联网·市场分析·市场报告·便携式太阳能折叠板·太阳能折叠板
yunhuibin1 小时前
AlexNet网络学习
人工智能·python·深度学习·神经网络
肾透侧视攻城狮1 小时前
《从fit()到分布式训练:深度解锁TensorFlow模型训练全栈技能》
人工智能·深度学习·tensorflow 模型训练·模型训练中的fit方法·自定义训练循环·回调函数使用·混合精度/分布式训练
索木木2 小时前
大模型训练CP切分(与TP、SP结合)
人工智能·深度学习·机器学习·大模型·训练·cp·切分
DevilSeagull2 小时前
C语言: 动态内存管理
人工智能·语言模型·自然语言处理
破晓之翼2 小时前
从第一性原理和工程控制论角度企业去思考AI开发避免完美主义陷阱
人工智能
njsgcs2 小时前
屏幕元素定位(Grounding) ollama两个模型
人工智能