企业级安全保障: 符合 ISO 27001 + SOC 2 Type I 标准。

Link to this sectionCityscapes8 数据集#

Link to this section简介#

Ultralytics Cityscapes8 数据集是一个精简的 语义分割 数据集,它包含从 Cityscapes 数据集中抽取的 8 张图像:4 张用于训练,4 张用于验证。它专为使用 YOLO 语义分割模型和训练流程进行快速测试、调试和实验而设计。在扩展到完整 Cityscapes 数据集之前,其城市场景内容可用于有效的流程检查。

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

注意

Cityscapes8 仅用于流水线测试,而非基准测试——其 8 张图像数量太少,无法进行有意义的 mIoU 比较。请使用完整的 Cityscapes 验证集以获得代表性结果。

Link to this section数据集结构#

Cityscapes8 沿用了完整数据集的布局,但没有 test 拆分:

cityscapes8/
├── images/
│   ├── train/  # 4 images
│   └── val/    # 4 images
└── masks/
    ├── train/  # 4 single-channel PNG masks
    └── val/    # 4 single-channel PNG masks

掩码通过 masks_dir: masks 字段与图像配对,label_mapping 将原始 Cityscapes 标签 ID 转换为 完整 Cityscapes 数据集结构 中描述的 19 个连续训练 ID。

Ultralytics Platform 上浏览 Cityscapes8,查看每张图像及其分割掩码,并将其克隆到云端进行训练。

Link to this section数据集 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

Link to this section用法#

要使用 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)

Link to this section引用、许可和致谢#

Cityscapes8 取样自 Cityscapes,后者基于 自定义非商业许可 发布——详情请参阅完整的 Cityscapes 数据集页面

如果你在研究或开发中使用 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 团队 为自动驾驶和计算机视觉社区所做的持续贡献。

Link to this section常见问题解答#

Link to this sectionUltralytics 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.

Link to this sectionCityscapes8 与完整的 Cityscapes 数据集有何区别?#

Cityscapes8 从 Cityscapes 的 2,975 张训练图像/500 张验证图像拆分中采样了 8 张图像(4 张训练,4 张验证),并使用了相同的 19 个类别和 label_mapping。因此,在 Cityscapes8 上运行的流水线可以在完整数据集上直接运行——只需将 data= 指向 cityscapes.yaml 而非 cityscapes8.yaml 即可。与完整数据集不同,Cityscapes8 无需手动下载步骤,也没有 test 拆分。

Link to this section如何使用 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 训练文档

Link to this section我应该使用 Cityscapes8 进行基准测试吗?#

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

评论