Cityscapes 데이터셋#
Cityscapes 데이터셋은 유럽 50개 도시에서 수집된 도시 거리 장면을 담은 대규모 semantic segmentation 벤치마크이며, 19개의 클래스에 걸쳐 2,975장의 정밀 어노테이션된 학습 이미지와 500장의 검증 이미지를 제공합니다. 이 데이터셋은 자율주행 연구 및 Ultralytics YOLO 모델을 활용한 도시 장면 이해를 위해 가장 널리 사용되는 데이터셋 중 하나입니다.
주요 특징#
- Cityscapes의 정밀 어노테이션은 19개 클래스에 걸쳐 2,975장의 학습 이미지와 500장의 검증 이미지를 포함하며, 아카이브에는 1,525장의 테스트 이미지도 함께 제공됩니다. 단, 공개된 마스크에는 자율주행 차량(ego-vehicle)과 이미지 테두리만 라벨링되어 있으며 실제 클래스 어노테이션은 제외되어 있습니다. 따라서 공식 테스트 세트 점수를 얻으려면 Cityscapes evaluation server에 예측 결과를 제출해야 합니다.
- 이 데이터셋은 평면, 사람, 차량, 건설, 객체, 자연 및 하늘 범주에 걸친 19개의 평가 클래스를 다룹니다.
- Cityscapes는 semantic segmentation을 위한 mean Intersection over Union(mIoU)과 같은 표준화된 평가 지표를 제공하여 모델 성능을 효과적으로 비교할 수 있도록 지원합니다.
- ~11 GB에 달하는 수동 다운로드를 진행하기 전에, 8개의 이미지로 구성된 Cityscapes8 서브셋을 통해 학습 파이프라인이 정상적으로 작동하는지 먼저 확인하세요.
데이터셋 구조#
Ultralytics 구성은 데이터 준비 후 다음과 같은 구조를 기대합니다:
cityscapes/
├── images/
│ ├── train/
│ ├── val/
│ └── test/
└── masks/
├── train/
├── val/
└── test/Cityscapes는 아카이브 자동 다운로드를 지원하지 않습니다. Cityscapes website에서 계정을 생성한 후 leftImg8bit_trainvaltest.zip 및 gtFine_trainvaltest.zip 아카이브(총 ~11 GB)를 다운로드하고, 두 아카이브 모두를 cityscapes 데이터셋 루트 디렉토리에 압축 해제하세요. 최초 학습 시 Ultralytics가 자동으로 이 파일들을 재구성하여 위의 images/ 및 masks/ 레이아웃으로 정리합니다.
시맨틱 마스크는 단일 채널 PNG 파일입니다. 원래 Cityscapes 라벨 ID는 label_mapping 섹션을 통해 표준 19개 학습 ID로 매핑되며, 무시되거나 빈(void) 라벨은 255로 매핑되어 학습 및 평가에서 제외됩니다.
공개된 gtFine/test 마스크는 자율주행 차량 및 이미지 테두리 영역만 라벨링하며, 다른 모든 클래스는 빈(void) 상태입니다. 로컬 평가를 위해 val 분할에서 mIoU를 계산하고, 공식 테스트 세트 점수를 확인하려면 Cityscapes evaluation server에 예측 결과를 제출해야 합니다.
응용 분야#
Cityscapes는 semantic segmentation에서 deep learning 모델을 학습하고 평가하는 데 널리 사용되며, 특히 autonomous driving, 첨단 운전자 보조 시스템(ADAS), 도시 로보틱스 분야에서 유용합니다.
고해상도 이미지와 상세한 어노테이션 덕분에 실시간 장면 구문 분석, 차선 및 장애물 이해, 그리고 복잡한 도시 환경에 대한 촘촘한 픽셀 수준의 이해가 필요한 모든 작업 연구에도 매우 가치가 있습니다. 사전 학습된 YOLO26 semantic segmentation 모델은 Cityscapes 검증 세트에서 최대 83.6 mIoU에 도달하며, 전체 벤치마크 표는 semantic segmentation models 페이지에서 확인할 수 있습니다. Ultralytics Platform을 사용하면 모델 개발 워크플로우 전반에 걸쳐 Cityscapes 데이터를 체계적으로 정리, 시각화 및 관리할 수 있습니다.
데이터셋 YAML#
데이터셋 YAML 파일은 Cityscapes 경로, 클래스, 마스크 디렉토리 및 라벨 매핑을 정의합니다. cityscapes.yaml 파일은 https://github.com/ultralytics/ultralytics/blob/main/ultralytics/cfg/datasets/cityscapes.yaml에서 유지관리됩니다.
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
# Cityscapes semantic segmentation dataset (19 classes)
# Documentation: https://docs.ultralytics.com/datasets/semantic/cityscapes
# Example usage: yolo semantic train data=cityscapes.yaml model=yolo26n-sem.pt
# parent
# ├── ultralytics
# └── datasets
# └── cityscapes ← downloads here (11 GB)
# └── images
# └── masks
# Dataset root directory
path: cityscapes # dataset root dir
train: images/train # train images (relative to 'path') 2975 images
val: images/val # val images (relative to 'path') 500 images
test: images/test # test images (relative to 'path') 1525 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
# Preparation script (requires manual Cityscapes download)
download: |
from pathlib import Path
from shutil import copy2
cityscapes_dir = Path(yaml["path"]) # dataset root dir
# Download and extract the official Cityscapes leftImg8bit and gtFine archives into cityscapes_dir first.
leftimg8bit_dir = cityscapes_dir / "leftImg8bit"
gtfine_dir = cityscapes_dir / "gtFine"
for split in ("train", "val", "test"):
print(f"Processing {split} set")
src_image_dir = leftimg8bit_dir / split
dst_image_dir = cityscapes_dir / "images" / split
dst_mask_dir = cityscapes_dir / "masks" / split
dst_image_dir.mkdir(parents=True, exist_ok=True)
dst_mask_dir.mkdir(parents=True, exist_ok=True)
image_paths = sorted(src_image_dir.rglob("*_leftImg8bit.png"))
for image_path in image_paths:
relative_path = image_path.relative_to(src_image_dir)
mask_path = gtfine_dir / split / relative_path.parent / image_path.name.replace(
"_leftImg8bit.png", "_gtFine_labelIds.png"
)
if not mask_path.exists():
raise FileNotFoundError(f"Mask not found for {image_path}: {mask_path}")
image_name = image_path.name.replace("_leftImg8bit", "")
mask_name = mask_path.name.replace("_gtFine_labelIds", "")
copy2(image_path, dst_image_dir / image_name)
copy2(mask_path, dst_mask_dir / mask_name)사용법#
이미지 크기 1024로 100 epochs 동안 Cityscapes 데이터셋에서 YOLO26n-sem 모델을 학습하려면 다음 코드 스니펫을 사용할 수 있습니다. 사용 가능한 인수에 대한 자세한 내용은 모델 Training 페이지를 참조하세요.
from ultralytics import YOLO
# Load a model
model = YOLO("yolo26n-sem.pt") # load a pretrained model (recommended for training)
# Train the model
results = model.train(data="cityscapes.yaml", epochs=100, imgsz=1024)인용, 라이선스 및 감사의 글#
Cityscapes는 custom non-commercial license에 따라 배포됩니다. 학술 연구 및 평가는 무료이지만, 데이터의 상업적 사용, 라이선스 부여 또는 재배포를 위해서는 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 팀에 감사를 표합니다. Cityscapes 데이터셋 및 제작자에 대한 자세한 내용은 Cityscapes dataset website를 방문해 주세요.
FAQ#
Cityscapes 데이터셋은 유럽 50개 도시의 도시 거리 장면을 다룬 대규모 semantic segmentation 벤치마크로, 자율주행 및 ADAS 연구의 표준 레퍼런스로 널리 사용됩니다. 정밀하게 어노테이션된 19개의 평가 클래스, 고해상도 이미지, 그리고 표준화된 mean Intersection over Union (mIoU) 지표 덕분에 고밀도 장면 이해 모델을 위한 가장 많이 인용되는 벤치마크 중 하나입니다.
이미지 크기 1024로 100 epochs 동안 Cityscapes 데이터셋에서 YOLO26n-sem 모델을 학습하려면 다음 코드 스니펫을 사용할 수 있습니다. 사용 가능한 인수의 자세한 목록은 모델 Training 페이지를 참조하세요.
훈련 예제from ultralytics import YOLO # Load a model model = YOLO("yolo26n-sem.pt") # load a pretrained model (recommended for training) # Train the model results = model.train(data="cityscapes.yaml", epochs=100, imgsz=1024)데이터셋 준비가 완료되면
images/{train,val,test}/및masks/{train,val,test}/디렉토리로 구성되며, 각 이미지는 단일 채널 PNG 마스크와 쌍을 이룹니다. Ultralytics YAML 파일은masks_dir: masks필드를 통해 각 이미지와 마스크를 연결하고,label_mapping을 사용하여 원래 Cityscapes 라벨 ID를 표준 19개의 연속된 학습 ID로 변환하며, 무시되거나 빈(void) 라벨을255로 매핑합니다.test분할의 마스크는 자율주행 차량 및 테두리 영역만 라벨링하므로, 로컬 mIoU 확인에는val을 사용하세요.네. Cityscapes website에서 계정을 만들고
leftImg8bit_trainvaltest.zip및gtFine_trainvaltest.zip아카이브(총 ~11 GB)를 다운로드하세요. 두 파일을cityscapes데이터셋 루트에 압축 해제하면, 최초 학습 시 Ultralytics가 자동으로 예상되는images/및masks/레이아웃으로 재구성합니다.Cityscapes 소스 마스크에는 평가에 사용되는 19개의 학습 ID와 다른 원래 라벨 ID가 저장되어 있습니다.
label_mapping섹션은 유효한 라벨을 연속된 클래스 ID0~18로 변환하며, 학습 및 검증 중 손실(loss)과 지표에서 제외되도록 무시되거나 빈(void) 라벨에255을 할당합니다.아니요. Cityscapes는 학술 연구, 교육 및 평가는 허용하지만 상업적 사용, 라이선스 부여 또는 데이터셋이나 2차적 저작물의 판매를 금지하는 non-commercial license에 따라 배포됩니다. 상업적 라이선스 옵션에 대해서는 Cityscapes 팀에 직접 문의하세요.