xView 数据集
xView 数据集是目前公开可用的最大规模高空俯瞰影像数据集之一,其中包含使用边界框标注的全球复杂场景图像。xView 数据集旨在加速四个计算机视觉前沿领域的发展:
- 降低检测所需的最低分辨率。
- 提高学习效率。
- 助力发现更多对象类别。
- 提升对细粒度类别的检测能力。
xView 建立在像 Common Objects in Context (COCO) 这样的挑战赛成功经验之上,旨在利用计算机视觉分析日益增多的太空影像,以便以新的方式理解视觉世界,并解决一系列重要的应用问题。
xView 数据集不会被 Ultralytics 脚本自动下载。你必须首先从官方来源手动下载数据集:
- 来源: DIUx xView 2018 挑战赛,由美国国家地理空间情报局 (NGA) 主办
- 网址: https://challenge.xviewdataset.org
重要提示: 在下载必要文件(例如 train_images.tif、val_images.tif、xView_train.geojson)后,你需要解压它们并将其放置到正确的目录结构中,通常期望位于 datasets/xView/ 文件夹下,然后再运行下面提供的训练命令。请确保数据集已按照挑战赛说明正确设置。
主要特性
- xView 包含 60 个类别中超过 100 万个对象实例。
- 该数据集的分辨率为 0.3 米,提供比大多数公共卫星影像数据集更高的图像分辨率。
- xView 具有包含多种小型、稀有、细粒度和多类型对象的集合,并带有 边界框 标注。
- 附带一个使用 TensorFlow 对象检测 API 的预训练基线模型和一个 PyTorch 示例。
数据集结构
xView 数据集由 WorldView-3 卫星在 0.3 米地面采样距离下采集的卫星图像组成。它包含超过 1,400 平方公里影像中 60 个类别的 100 多万个对象。该数据集对于遥感应用和环境监测特别有价值。
应用场景
xView 数据集被广泛用于训练和评估用于高空俯瞰影像对象检测的深度学习模型。数据集多样的对象类别和高分辨率图像使其成为计算机视觉领域(特别是卫星影像分析)研究人员和从业者的宝贵资源。应用包括:
- 军事和防御侦察
- 城市规划与发展
- 环境监测
- 灾害响应与评估
- 基础设施测绘与管理
数据集 YAML
YAML (Yet Another Markup Language) 文件用于定义数据集配置。它包含有关数据集路径、类别及其他相关信息。对于 xView 数据集,xView.yaml 文件维护在 https://github.com/ultralytics/ultralytics/blob/main/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")使用方法
若要使用 640 的图像尺寸在 xView 数据集上训练模型 100 个 epoch,你可以使用以下代码片段。有关可用参数的完整列表,请参阅模型 训练 页面。
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 数据集包含高分辨率卫星图像,其中有使用边界框标注的多样化对象。以下是来自数据集的一些数据示例及其对应的标注:

- 俯瞰影像:此图像展示了俯瞰影像中对象检测的一个示例,其中对象用边界框进行了标注。该数据集提供高分辨率卫星图像,以促进该任务模型的发展。
该示例展示了 xView 数据集中数据的多样性和复杂性,并强调了高质量卫星影像对于对象检测任务的重要性。
相关数据集
如果你正在处理卫星影像,你可能也会对探索这些相关数据集感兴趣:
引文与致谢
如果你在研究或开发工作中使用了 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 数据集及其创建者的信息,请访问 xView 数据集网站。
常见问题 (FAQ)
什么是 xView 数据集,它如何造福计算机视觉研究?
xView 数据集是目前公开可用的最大规模高分辨率俯瞰影像合集之一,包含 60 个类别中超过 100 万个对象实例。它旨在增强计算机视觉研究的各个方面,例如降低检测的最低分辨率、提高学习效率、发现更多对象类别以及推进细粒度对象检测。
如何使用 Ultralytics YOLO 在 xView 数据集上训练模型?
若要使用 Ultralytics YOLO 在 xView 数据集上训练模型,请按照以下步骤操作:
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 数据集的主要特点是什么?
xView 数据集凭借其全面的功能而脱颖而出:
- 60 个不同类别中超过 100 万个对象实例。
- 0.3 米的高分辨率影像。
- 多样的对象类型,包括小型、稀有和细粒度对象,所有对象均带有边界框标注。
- 提供预训练基线模型,并附带 TensorFlow 和 PyTorch 示例。
xView 的数据集结构是什么样的,它是如何标注的?
xView 数据集包含由 WorldView-3 卫星在 0.3 米地面采样距离下捕获的高分辨率卫星影像,涵盖了约 1,400 平方公里标注影像中 60 个不同类别的 100 多万个对象。每个对象都用边界框标记,这使得该数据集非常适合训练和评估用于俯瞰视角对象检测的深度学习模型。有关详细分解,请参阅数据集结构部分。
我该如何在研究中引用 xView 数据集?
如果你在研究中使用了 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}
}有关 xView 数据集的更多信息,请访问官方 xView 数据集网站。