常见的目标检测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)
相关推荐
Mid_search25 分钟前
随机排列与Fisher-Yates算法
人工智能·深度学习·强化学习·随机排列·fisher-yates
ZGIAI5 小时前
ZGI Workflow:条件分支走错时先查哪一层
人工智能·架构
X54先生(人文科技)5 小时前
《元创力》纪实录 · 桥段 《窑变纪元:一份来自星历2227年的深空考古笔记》
人工智能·开源·ai写作·零知识证明
ZGIAI5 小时前
ZGI 文件产物:生成报告后怎样交付
人工智能·架构
东方-教育技术博主5 小时前
自动编码在教育场景中的重要性:一项基于多源证据的深度综述
大数据·人工智能
骥龙5 小时前
模块二:Ollama本地模型部署与OpenCode代理配置
人工智能
阡之尘埃5 小时前
Python数据分析案例85——大模型微调全流程(SFT的LoRA微调)
人工智能·python·深度学习·语言模型·llm·微调·千问
Regentsoft丽晶软件5 小时前
品牌方新品上市促销政策无法实时同步经销商,有没有支持总部-经销商-终端一站式的分销解决方案?
人工智能·经验分享·数据库架构
liuqs3325 小时前
机器人产业加速发展,制造业正在迎来新的自动化探索
大数据·人工智能
腾讯云大数据5 小时前
DataBuddy数据语义驱动的企业Agent Runtime实践
大数据·人工智能·腾讯云·agent