Cityscapes8 数据集

简介

Ultralytics Cityscapes8 数据集是一个精简的语义分割数据集,包含从 Cityscapes 数据集中采样的 8 张图像:4 张用于训练,4 张用于验证。它旨在为 YOLO 语义分割模型和训练流水线提供快速测试、调试和实验环境。其城市场景内容在扩展至完整 Cityscapes 数据集之前,可作为流水线的实用检查手段。

Cityscapes8 使用与完整 Cityscapes 数据集相同的 19 个评估类别以及相同的 label_mapping 行为,并完全兼容 YOLO26 语义分割工作流。

数据集 YAML

The Cityscapes8 dataset configuration is defined in a dataset YAML file, which specifies dataset paths, class names, and other essential metadata. You can review the official cityscapes8.yaml file in the Ultralytics GitHub repository. The YAML includes a download URL for the small packaged subset.

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

# Cityscapes semantic segmentation dataset (19 classes)
# Documentation: https://docs.ultralytics.com/datasets/semantic/cityscapes8/
# Example usage: yolo semantic train data=cityscapes8.yaml model=yolo26n-sem.pt
# parent
# ├── ultralytics
# └── datasets
#     └── cityscapes8 ← downloads here (small subset)
#         └── images
#         └── masks

# Dataset root directory
path: cityscapes8 # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images

masks_dir: masks # semantic mask directory

# Cityscapes 19-class labels
names:
  0: road
  1: sidewalk
  2: building
  3: wall
  4: fence
  5: pole
  6: traffic light
  7: traffic sign
  8: vegetation
  9: terrain
  10: sky
  11: person
  12: rider
  13: car
  14: truck
  15: bus
  16: train
  17: motorcycle
  18: bicycle

# Map source label IDs to train IDs; ignore_label is converted to 255.
label_mapping:
  -1: ignore_label
  0: ignore_label
  1: ignore_label
  2: ignore_label
  3: ignore_label
  4: ignore_label
  5: ignore_label
  6: ignore_label
  7: 0
  8: 1
  9: ignore_label
  10: ignore_label
  11: 2
  12: 3
  13: 4
  14: ignore_label
  15: ignore_label
  16: ignore_label
  17: 5
  18: ignore_label
  19: 6
  20: 7
  21: 8
  22: 9
  23: 10
  24: 11
  25: 12
  26: 13
  27: 14
  28: 15
  29: ignore_label
  30: ignore_label
  31: 16
  32: 17
  33: 18

# Download URL (optional)
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/cityscapes8.zip

使用方法

要使用 1024 的图像大小对 Cityscapes8 数据集训练 YOLO26n-sem 模型 100 个 epoch,请参考以下示例。有关训练选项的完整列表,请参阅 YOLO 训练文档

训练示例
from ultralytics import YOLO

# Load a pretrained YOLO26n-sem model
model = YOLO("yolo26n-sem.pt")

# Train the model on Cityscapes8
results = model.train(data="cityscapes8.yaml", epochs=100, imgsz=1024)

引用与致谢

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

引用
@inproceedings{Cordts2016Cityscapes,
  title={The Cityscapes Dataset for Semantic Urban Scene Understanding},
  author={Cordts, Marius and Omran, Mohamed and Ramos, Sebastian and Rehfeld, Timo and Enzweiler, Markus and Benenson, Rodrigo and Franke, Uwe and Roth, Stefan and Schiele, Bernt},
  booktitle={Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2016}
}

特别感谢 Cityscapes 团队为自动驾驶和计算机视觉社区所做出的持续贡献。

常见问题

Ultralytics Cityscapes8 数据集的用途是什么?

The Ultralytics Cityscapes8 dataset is designed for rapid testing and debugging of semantic segmentation models. With only 8 images (4 for training, 4 for validation), it is ideal for verifying YOLO semantic segmentation pipelines, including mask loading, augmentations, validation, and export paths, before scaling to the full Cityscapes dataset. Explore the Cityscapes8 YAML configuration for more details.

我该如何使用 Cityscapes8 数据集训练 YOLO26 模型?

你可以使用 Python 或 CLI 在 Cityscapes8 上训练 YOLO26 语义分割模型:

训练示例
from ultralytics import YOLO

# Load a pretrained YOLO26n-sem model
model = YOLO("yolo26n-sem.pt")

# Train the model on Cityscapes8
results = model.train(data="cityscapes8.yaml", epochs=100, imgsz=1024)

如需更多训练选项,请参考 YOLO 训练文档

我应该使用 Cityscapes8 进行基准测试吗?

不建议。Cityscapes8 规模太小,无法进行有意义的模型比较,它仅适用于训练和评估流水线的检查。当你需要具有代表性的语义分割基准测试结果时,请使用完整的 Cityscapes 验证集。

评论