Link to this sectionCityscapes8 数据集#
Link to this section简介#
Ultralytics Cityscapes8 数据集是一个精简的 语义分割 数据集,它包含从 Cityscapes 数据集中抽取的 8 张图像:4 张用于训练,4 张用于验证。它专为使用 YOLO 语义分割模型和训练流程进行快速测试、调试和实验而设计。在扩展到完整 Cityscapes 数据集之前,其城市场景内容可用于有效的流程检查。
Cityscapes8 使用与完整 Cityscapes 数据集相同的 19 个评估类和相同的 label_mapping 行为,并与 YOLO26 语义分割工作流完全兼容。
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 🚀 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.zipLink 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引用与致谢#
如果你在研究或开发中使用 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 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 验证集。