常见的目标检测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)
相关推荐
阿里云大数据AI技术1 小时前
阿里云 Milvus 磁盘索引新利器:百万级Topk高性能召回
人工智能
独立开发者阿乐1 小时前
llms.txt 是什么?为什么 AI 爬虫需要这个文件
人工智能·爬虫·geo优化·ai爬虫·llms.txt·ai收录·robots.txt
福兮说2 小时前
秋招简历让 AI 写了一版:它替我加了 JWT,还把课程设计写成了「高并发」
人工智能·课程设计·秋招·求职·简历
ZDN_is_beauty2 小时前
深度学习2-卷积神经网络
人工智能·深度学习·cnn
QQ机器人_插件2 小时前
鲲鹏恒控的跨平台交付 —— Windows 上组态,Linux 上运行
人工智能
XMAIPC_Robot2 小时前
储能控制器产品化:ARM+FPGA整机高低温、EMC可靠性测试实战总结
arm开发·人工智能·fpga开发·arm+fpga·rk3588+fpga
Martina_03212 小时前
AI生成的海岸城市一移动镜头,水面反射就跳?用6步统一反射探针、SSR与平面反射
图像处理·人工智能·平面·3d·ai·自然语言处理·游戏策划
Matlab程序猿2 小时前
【MATLAB源码-第459期】基于matlab的D-H模型与阻尼最小二乘逆运动学的六自由度机械臂五次轨迹规划及动力学前馈PD控制仿真。
人工智能·算法·matlab·d-h建模·六自由度串联机械臂
QYR-分析2 小时前
人机交互升级浪潮下,全球电容式触摸传感器市场格局与细分赛道深度研判
人工智能·人机交互
血小溅2 小时前
什么是 Agent?
人工智能