YOLO Vision 2026:

xView 数据集#

xView 数据集是最大的公开卫星影像对象检测基准之一,在 1,400 多平方公里的 0.3 米 WorldView-3 影像中,提供了跨越 60 个类别的 100 多万个对象实例,这些实例带有边界框注释。它由美国国家地理空间情报局 (NGA) 为 DIUx xView 2018 挑战赛发布,需要手动下载约 20.7 GB 的数据。

该数据集的创建旨在推动四个计算机视觉前沿领域:

  1. 降低检测的最低分辨率。
  2. 提高学习效率。
  3. 支持发现更多目标类别。
  4. 改进细粒度类别的检测。

COCO 等基准为基础,xView 专注于航拍影像,其中的对象比地面照片中的对象小得多且更密集。

需要手动下载

xView 数据集不会自动下载。请在 DIUx xView 2018 Challenge 网站注册以统筹下载 train_images.zip(~15 GB)、train_labels.zipval_images.zip(~5 GB),然后将它们解压到 datasets/xView/ 下,使其包含:

datasets/xView/
├── train_images/          # 847 TIF satellite images
├── val_images/            # 282 TIF images (no public labels)
└── xView_train.geojson    # bounding-box annotations

在首次训练运行时,Ultralytics 会自动将 GeoJSON 标注转换为 YOLO 格式,并将带标签的图像按约 90/10 的比例划分为训练集和验证集——无需手动转换。

主要特性#

  • 细粒度类别:涵盖飞机、车辆、铁路车辆、海事船只、工程机械和建筑物等 60 个对象类别——许多物体体积小、罕见且视觉上相似。
  • 高分辨率:从 WorldView-3 卫星采集的 0.3 米地面采样距离 (GSD) 影像。
  • 密集标注:在超过 1,400 平方公里的影像中,有超过 100 万个对象实例,全部使用水平边界框进行标注。
  • 自动转换:Ultralytics 下载脚本会在首次使用时将原始 GeoJSON 标签转换为 YOLO 格式,并生成训练集/验证集划分。

数据集结构#

xView 图像是 TIF 格式的大型卫星场景,只有 847 张训练图像带有公开标签——282 张图像的挑战赛验证集没有标签。因此,Ultralytics xView.yaml 配置会在首次使用时自动拆分带标签的图像:

拆分图像描述
训练~847 张中的 90%列在 autosplit_train.txt 中的带标签图像,在首次运行时生成
验证~847 张中的 10%列在 autosplit_val.txt 中的带标签图像,用于评估

这 60 个类别涵盖了固定翼飞机、货机、小型汽车、公共汽车、机车、海运船只、挖掘机、建筑物、飞机机库和储油罐等细粒度类别;完整列表在下方的数据集 YAML 中。在转换过程中,原始挑战赛类别 ID (11–94) 被重新映射到连续的索引 0–59。

应用#

xView 的细粒度类别和高分辨率俯视视角使其成为训练和评估远程传感中的深度学习模型的标准基准。常见应用包括:

  • 军事和国防侦察
  • 城市规划和开发
  • 环境监测
  • 灾害响应和评估
  • 基础设施测绘和管理

有关其他航拍影像基准,请参阅以无人机为重点的 VisDrone dataset 或定向框 DOTA-v2 dataset

数据集 YAML#

xView.yaml 文件定义了数据集配置——数据集路径、60 个类别的名称以及转换 GeoJSON 注释并生成自动拆分的下载脚本。它维护在 Ultralytics 仓库中:https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/xView.yaml

ultralytics/cfg/datasets/xView.yaml
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

# DIUx xView 2018 Challenge dataset https://challenge.xviewdataset.org by U.S. National Geospatial-Intelligence Agency (NGA)
# --------  Download and extract data manually to `datasets/xView` before running the train command.  --------
# Documentation: https://docs.ultralytics.com/datasets/detect/xview
# Example usage: yolo train data=xView.yaml
# parent
# ├── ultralytics
# └── datasets
#     └── xView ← downloads here (20.7 GB)

# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: xView # dataset root dir
train: images/autosplit_train.txt # train images (relative to 'path') 90% of 847 train images
val: images/autosplit_val.txt # val images (relative to 'path') 10% of 847 train images

# Classes
names:
  0: Fixed-wing Aircraft
  1: Small Aircraft
  2: Cargo Plane
  3: Helicopter
  4: Passenger Vehicle
  5: Small Car
  6: Bus
  7: Pickup Truck
  8: Utility Truck
  9: Truck
  10: Cargo Truck
  11: Truck w/Box
  12: Truck Tractor
  13: Trailer
  14: Truck w/Flatbed
  15: Truck w/Liquid
  16: Crane Truck
  17: Railway Vehicle
  18: Passenger Car
  19: Cargo Car
  20: Flat Car
  21: Tank car
  22: Locomotive
  23: Maritime Vessel
  24: Motorboat
  25: Sailboat
  26: Tugboat
  27: Barge
  28: Fishing Vessel
  29: Ferry
  30: Yacht
  31: Container Ship
  32: Oil Tanker
  33: Engineering Vehicle
  34: Tower crane
  35: Container Crane
  36: Reach Stacker
  37: Straddle Carrier
  38: Mobile Crane
  39: Dump Truck
  40: Haul Truck
  41: Scraper/Tractor
  42: Front loader/Bulldozer
  43: Excavator
  44: Cement Mixer
  45: Ground Grader
  46: Hut/Tent
  47: Shed
  48: Building
  49: Aircraft Hangar
  50: Damaged Building
  51: Facility
  52: Construction Site
  53: Vehicle Lot
  54: Helipad
  55: Storage Tank
  56: Shipping container lot
  57: Shipping Container
  58: Pylon
  59: Tower

# Download script/URL (optional) ---------------------------------------------------------------------------------------
download: |
  import json
  from pathlib import Path
  import shutil

  import numpy as np
  from PIL import Image

  from ultralytics.utils import TQDM
  from ultralytics.data.split import autosplit
  from ultralytics.utils.ops import xyxy2xywhn

  def convert_labels(fname=Path("xView/xView_train.geojson")):
      """Convert xView GeoJSON labels to YOLO format (classes 0-59) and save them as text files."""
      path = fname.parent
      with open(fname, encoding="utf-8") as f:
          print(f"Loading {fname}...")
          data = json.load(f)

      # Make dirs
      labels = path / "labels" / "train"
      shutil.rmtree(labels, ignore_errors=True)
      labels.mkdir(parents=True, exist_ok=True)

      # xView classes 11-94 to 0-59
      xview_class2index = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, -1, 3, -1, 4, 5, 6, 7, 8, -1, 9, 10, 11,
                           12, 13, 14, 15, -1, -1, 16, 17, 18, 19, 20, 21, 22, -1, 23, 24, 25, -1, 26, 27, -1, 28, -1,
                           29, 30, 31, 32, 33, 34, 35, 36, 37, -1, 38, 39, 40, 41, 42, 43, 44, 45, -1, -1, -1, -1, 46,
                           47, 48, 49, -1, 50, 51, -1, 52, -1, -1, -1, 53, 54, -1, 55, -1, -1, 56, -1, 57, -1, 58, 59]

      shapes = {}
      for feature in TQDM(data["features"], desc=f"Converting {fname}"):
          p = feature["properties"]
          if p["bounds_imcoords"]:
              image_id = p["image_id"]
              image_file = path / "train_images" / image_id
              if image_file.exists():  # 1395.tif missing
                  try:
                      box = np.array([int(num) for num in p["bounds_imcoords"].split(",")])
                      assert box.shape[0] == 4, f"incorrect box shape {box.shape[0]}"
                      cls = p["type_id"]
                      cls = xview_class2index[int(cls)]  # xView class to 0-59
                      assert 59 >= cls >= 0, f"incorrect class index {cls}"

                      # Write YOLO label
                      if image_id not in shapes:
                          shapes[image_id] = Image.open(image_file).size
                      box = xyxy2xywhn(box[None].astype(float), w=shapes[image_id][0], h=shapes[image_id][1], clip=True)
                      with open((labels / image_id).with_suffix(".txt"), "a", encoding="utf-8") as f:
                          f.write(f"{cls} {' '.join(f'{x:.6f}' for x in box[0])}\n")  # write label.txt
                  except Exception as e:
                      print(f"WARNING: skipping one label for {image_file}: {e}")

  # Download manually from https://challenge.xviewdataset.org
  dir = Path(yaml["path"])  # dataset root dir
  # urls = [
  #     "https://d307kc0mrhucc3.cloudfront.net/train_labels.zip",  # train labels
  #     "https://d307kc0mrhucc3.cloudfront.net/train_images.zip",  # 15G, 847 train images
  #     "https://d307kc0mrhucc3.cloudfront.net/val_images.zip",  # 5G, 282 val images (no labels)
  # ]
  # download(urls, dir=dir)

  # Convert labels
  convert_labels(dir / "xView_train.geojson")

  # Move images
  images = Path(dir / "images")
  images.mkdir(parents=True, exist_ok=True)
  Path(dir / "train_images").rename(dir / "images" / "train")
  Path(dir / "val_images").rename(dir / "images" / "val")

  # Split
  autosplit(dir / "images" / "train")

用法#

20.7 GB 手动下载

训练期望将上述手动下载的内容解压到 datasets/xView/ 下;随后注释转换和训练/验证集拆分将自动运行。

要在 xView 数据集上以 640 的图像大小训练模型 100 个周期,你可以使用以下代码片段。有关可用参数的完整列表,请参考模型训练页面。

训练示例
from ultralytics import YOLO

# Load a model
model = YOLO("yolo26n.pt")  # load a pretrained model (recommended for training)

# Train the model
results = model.train(data="xView.yaml", epochs=100, imgsz=640)

要在浏览器中标记更多卫星图像并管理 xView 训练运行,请使用 Ultralytics Platform

示例数据与标注#

下面的示例展示了一个典型的 xView 场景:高分辨率俯拍影像,其中车辆和建筑物等小型对象标有边界框,这说明了为什么卫星影像中的对象检测需要细粒度定位。

xView dataset overhead satellite imagery with object detection

引用与致谢#

如果你在研究或开发工作中使用了 xView 数据集,请引用以下论文:

引用
@misc{lam2018xview,
      title={xView: Objects in Context in Overhead Imagery},
      author={Darius Lam and Richard Kuzma and Kevin McGee and Samuel Dooley and Michael Laielli and Matthew Klaric and Yaroslav Bulatov and Brendan McCord},
      year={2018},
      eprint={1802.07856},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

我们要感谢国防创新小组 (DIU) 以及 xView 数据集的创建者,感谢他们为计算机视觉研究社区做出的宝贵贡献。有关更多信息,请访问 xView dataset website

常见问题解答#

  • xView 数据集是由美国国家地理空间情报局为 DIUx xView 2018 挑战赛发布的卫星影像基准,在 0.3 米 WorldView-3 影像中提供了跨越 60 个细粒度类别的 100 多万个对象实例。它支持在俯视视角中检测小型、罕见和细粒度对象的研究,这些对象比地面照片中的目标要难得多。

  • xView 需要手动下载:在 DIUx xView 2018 Challenge 网站上注册,下载 train_images.zip(~15 GB)、train_labels.zipval_images.zip(~5 GB)——总共约 20.7 GB——并按照本页顶部警告中显示的布局将其解压到 datasets/xView/ 下。在首次训练运行中,Ultralytics 会自动将 GeoJSON 注释转换为 YOLO 格式并创建训练/验证集拆分。

  • xView 包含 847 张带标签的训练图像和 282 张没有公开标签的验证图像,全部由 WorldView-3 卫星以 0.3 米的分辨率捕获。注释涵盖了跨越 60 个类别的 100 多万个对象实例。由于只有训练标签是公开的,Ultralytics xView.yaml 配置将 847 张带标签的图像大约按 90/10 的比例拆分为训练集和验证集;有关详情,请参阅数据集结构

  • 在 xView 上训练 YOLO26n 模型,图像大小为 640,训练 100 个周期:

    训练示例
    from ultralytics import YOLO
    
    # Load a model
    model = YOLO("yolo26n.pt")  # load a pretrained model (recommended for training)
    
    # Train the model
    results = model.train(data="xView.yaml", epochs=100, imgsz=640)

    有关详细的参数和设置,请参考模型训练页面。

  • 引用论文“xView: Objects in Context in Overhead Imagery”(Lam 等人,arXiv:1802.07856,2018);完整的 BibTeX 条目位于上方引用和致谢部分。

评论