跳至内容

定向边框(OBB)数据集概述

Training a precise object detection model with oriented bounding boxes (OBB) requires a thorough dataset. This guide explains the various OBB dataset formats compatible with Ultralytics YOLO models, offering insights into their structure, application, and methods for format conversions.

支持的 OBB 数据集格式

YOLO OBB 格式

YOLO OBB 格式通过四个角点指定边界框,其坐标在 0 和 1 之间归一化:

class_index x1 y1 x2 y2 x3 y3 x4 y4

YOLO 在内部处理损失和产出。 xywhr format, which represents the bounding box's center point (xy), width, height, and rotation.

OBB 格式示例

一个例子 *.txt 标签文件,其中包含一个类 0 OBB 格式,可以是这样的

0 0.780811 0.743961 0.782371 0.74686 0.777691 0.752174 0.776131 0.749758

使用方法

要使用这些 OBB 格式训练模型:

示例

from ultralytics import YOLO

# Create a new YOLO11n-OBB model from scratch
model = YOLO("yolo11n-obb.yaml")

# Train the model on the DOTAv1 dataset
results = model.train(data="DOTAv1.yaml", epochs=100, imgsz=1024)
# Train a new YOLO11n-OBB model on the DOTAv1 dataset
yolo obb train data=DOTAv1.yaml model=yolo11n-obb.pt epochs=100 imgsz=1024

支持的数据集

目前支持以下带有定向边框的数据集:

  • DOTA-v1: The first version of the DOTA dataset, providing a comprehensive set of aerial images with oriented bounding boxes for object detection.
  • DOTA-v1.5: An intermediate version of the DOTA dataset, offering additional annotations and improvements over DOTA-v1 for enhanced object detection tasks.
  • DOTA-v2:DOTA(用于航空图像中物体检测的大规模数据集)第 2 版强调从航空角度进行检测,包含 170 万个实例和 11 268 幅图像的定向边界框。
  • DOTA8:完整 DOTA 数据集的 8 幅图像子集,适用于测试工作流程和 OBB 培训的持续集成 (CI) 检查。 ultralytics 存放处。

加入自己的 OBB 数据集

对于那些希望使用定向边界框引入自己的数据集的用户,请确保与上述 "YOLO OBB 格式 "兼容。将您的注释转换为这种所需的格式,并在相应的 YAML 配置文件中详细说明路径、类和类名。

转换标签格式

将 DOTA 数据集格式转换为YOLO OBB 格式

使用该脚本可以将标签从 DOTA 数据集格式转换为YOLO OBB 格式:

示例

from ultralytics.data.converter import convert_dota_to_yolo_obb

convert_dota_to_yolo_obb("path/to/DOTA")

这种转换机制对 DOTA 格式的数据集非常有用,可确保与Ultralytics YOLO OBB 格式保持一致。

必须验证数据集与模型的兼容性,并遵守必要的格式约定。结构合理的数据集对于训练具有定向边界框的高效物体检测模型至关重要。

常见问题

什么是定向边界框 (OBB),在Ultralytics YOLO 模型中如何使用?

定向边框 (OBB) 是一种边框注释类型,边框可以旋转,以便更紧密地与检测对象对齐,而不仅仅是与轴对齐。这在航空或卫星图像中特别有用,因为在这些图像中,物体可能不会与图像轴线对齐。在Ultralytics YOLO 模型中,OBB 由YOLO OBB 格式中的四个角点表示。这样可以更准确地检测到物体,因为边界框可以旋转以更好地适应物体。

How do I convert my existing DOTA dataset labels to YOLO OBB format for use with Ultralytics YOLO11?

您可以使用以下工具将 DOTA 数据集标签转换为YOLO OBB 格式 convert_dota_to_yolo_obb Ultralytics这种转换确保了与Ultralytics YOLO 模型的兼容性,使您能够利用 OBB 功能增强对象检测。下面是一个快速示例:

from ultralytics.data.converter import convert_dota_to_yolo_obb

convert_dota_to_yolo_obb("path/to/DOTA")

该脚本将把 DOTA 注释重新格式化为YOLO 兼容的格式。

How do I train a YOLO11 model with oriented bounding boxes (OBB) on my dataset?

Training a YOLO11 model with OBBs involves ensuring your dataset is in the YOLO OBB format and then using the Ultralytics API to train the model. Here's an example in both Python and CLI:

示例

from ultralytics import YOLO

# Create a new YOLO11n-OBB model from scratch
model = YOLO("yolo11n-obb.yaml")

# Train the model on the custom dataset
results = model.train(data="your_dataset.yaml", epochs=100, imgsz=640)
# Train a new YOLO11n-OBB model on the custom dataset
yolo obb train data=your_dataset.yaml model=yolo11n-obb.yaml epochs=100 imgsz=640

This ensures your model leverages the detailed OBB annotations for improved detection accuracy.

Ultralytics YOLO 模型中的 OBB 训练目前支持哪些数据集?

目前,Ultralytics 支持以下用于 OBB 训练的数据集:

  • DOTA-v1: The first version of the DOTA dataset, providing a comprehensive set of aerial images with oriented bounding boxes for object detection.
  • DOTA-v1.5: An intermediate version of the DOTA dataset, offering additional annotations and improvements over DOTA-v1 for enhanced object detection tasks.
  • DOTA-v2:该数据集包括 170 万个带定向边界框的实例和 11 268 幅图像,主要侧重于航空物体检测。
  • DOTA8:DOTA 数据集中较小的 8 幅图像子集,用于测试和持续集成 (CI) 检查。

这些数据集是专为 OBBs 具有显著优势的场景(如航空和卫星图像分析)量身定制的。

Can I use my own dataset with oriented bounding boxes for YOLO11 training, and if so, how?

Yes, you can use your own dataset with oriented bounding boxes for YOLO11 training. Ensure your dataset annotations are converted to the YOLO OBB format, which involves defining bounding boxes by their four corner points. You can then create a YAML configuration file specifying the dataset paths, classes, and other necessary details. For more information on creating and configuring your datasets, refer to the Supported Datasets section.

📅 Created 11 months ago ✏️ Updated 20 days ago

评论