常见的目标检测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)
相关推荐
人有一心几秒前
深度学习中显性特征组合的网络结构crossNet
人工智能·深度学习
机器之心2 分钟前
用光学生成图像,几乎0耗电,浙大校友一作研究登Nature
人工智能·openai
苏苏susuus37 分钟前
NLP:Transformer之self-attention(特别分享3)
人工智能·自然语言处理·transformer
猫天意40 分钟前
【目标检测】metrice_curve和loss_curve对比图可视化
人工智能·深度学习·目标检测·计算机视觉·cv
山烛1 小时前
OpenCV:图像透视变换
人工智能·opencv·计算机视觉·图像透视变换
艾醒(AiXing-w)1 小时前
探索大语言模型(LLM):Ollama快速安装部署及使用(含Linux环境下离线安装)
linux·人工智能·语言模型
月小水长1 小时前
大模型接入自定义 MCP Server,我开发了个免费使用的基金涨跌归纳和归因分析的 Agent
人工智能·后端
咏方舟【长江支流】2 小时前
AI+华为HarmonyOS开发工具DevEco Studio详细安装指南
人工智能·华为·移动开发·harmonyos·arkts·deveco studio·长江支流
阿里云云原生2 小时前
Qoder 全新「上下文压缩」功能正式上线,省 Credits !
人工智能
我星期八休息2 小时前
深入理解跳表(Skip List):原理、实现与应用
开发语言·数据结构·人工智能·python·算法·list