Cityscapes8 Dataset
Introduction
The Ultralytics Cityscapes8 dataset is a compact semantic segmentation dataset with 8 images sampled from the Cityscapes dataset: 4 for training and 4 for validation. It is designed for rapid testing, debugging, and experimentation with YOLO semantic segmentation models and training pipelines. Its urban-scene content provides a useful pipeline check before scaling to the full Cityscapes dataset.
Cityscapes8 uses the same 19 evaluation classes and the same label_mapping behavior as the full Cityscapes dataset, and is fully compatible with YOLO26 semantic segmentation workflows.
Dataset 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.zipUsage
To train a YOLO26n-sem model on the Cityscapes8 dataset for 100 epochs with an image size of 1024, use the following examples. For a full list of training options, see the YOLO Training documentation.
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)Citations and Acknowledgments
If you use the Cityscapes dataset in your research or development, please cite the following paper:
@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}
}Special thanks to the Cityscapes team for their ongoing contributions to the autonomous driving and computer vision communities.
FAQ
What Is the Ultralytics Cityscapes8 Dataset Used For?
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.
How Do I Train a YOLO26 Model Using the Cityscapes8 Dataset?
You can train a YOLO26 semantic segmentation model on Cityscapes8 using either Python or the CLI:
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)For additional training options, refer to the YOLO Training documentation.
Should I Use Cityscapes8 for Benchmarking?
No. Cityscapes8 is too small for meaningful model comparison and is intended for training and evaluation pipeline checks. Use the full Cityscapes validation set when you need representative benchmark results for semantic segmentation.