Cityscapes 데이터셋#
Cityscapes 데이터셋은 유럽 50개 도시에서 촬영한 도시 거리 장면으로 구성된 대규모 semantic segmentation 벤치마크로, 19개 클래스에 걸쳐 정밀하게 주석 처리된 학습 이미지 2,975개와 검증 이미지 500개를 포함합니다. 자율주행 연구와 Ultralytics YOLO 모델을 활용한 도시 장면 이해에 가장 널리 사용되는 데이터셋 중 하나입니다.
주요 기능#
- Cityscapes fine annotation에는 19개 클래스에 걸쳐 학습 이미지 2,975개와 검증 이미지 500개가 포함됩니다. 아카이브에는 테스트 이미지 1,525개도 포함되어 있지만, 공개된 마스크에는 ego-vehicle과 이미지 경계만 레이블되어 있습니다. 실제 클래스 주석은 공개되지 않으며, 공식 테스트 세트 점수를 얻으려면 예측 결과를 Cityscapes 평가 서버에 제출해야 합니다.
- 데이터셋은 flat, human, vehicle, construction, object, nature, sky 카테고리에 걸친 19개의 평가 클래스를 포함합니다.
- Cityscapes는 semantic segmentation을 위한 mean Intersection over Union(mIoU)과 같은 표준화된 평가 지표를 제공하므로 모델 성능을 효과적으로 비교할 수 있습니다.
- 약 11GB의 수동 다운로드를 진행하기 전에 8개 이미지로 구성된 Cityscapes8 서브셋을 사용하여 학습 파이프라인을 먼저 점검하십시오.
데이터셋 구조#
준비가 완료된 후 Ultralytics 구성에서는 다음과 같은 레이아웃을 요구합니다.
cityscapes/
├── images/
│ ├── train/
│ ├── val/
│ └── test/
└── masks/
├── train/
├── val/
└── test/Cityscapes는 아카이브 자동 다운로드를 지원하지 않습니다. Cityscapes 웹사이트에서 계정을 만든 다음 leftImg8bit_trainvaltest.zip 및 gtFine_trainvaltest.zip 아카이브(총 약 11GB)를 다운로드하고, 두 아카이브를 모두 cityscapes 데이터셋 루트에 압축 해제하십시오. 처음 학습을 시작할 때 Ultralytics가 자동으로 두 아카이브를 위의 images/ 및 masks/ 레이아웃으로 재구성합니다.
semantic mask는 단일 채널 PNG 파일입니다. 원본 Cityscapes label ID는 label_mapping 섹션을 통해 표준 19개 train ID로 매핑되며, 무시되거나 void인 레이블은 255로 매핑되어 학습과 평가에서 제외됩니다.
공개된 gtFine/test 마스크에는 ego-vehicle 및 이미지 경계 영역만 레이블되어 있으며, 다른 모든 클래스는 void입니다. 로컬 평가를 위해 val split에서 mIoU를 계산하십시오. 공식 테스트 세트 점수를 얻으려면 예측 결과를 Cityscapes 평가 서버에 제출해야 합니다.
응용 분야#
Cityscapes는 semantic segmentation에서 deep learning 모델을 학습하고 평가하는 데 널리 사용되며, 특히 autonomous driving, 첨단 운전자 지원 시스템(ADAS), 도시 로보틱스 분야에서 많이 활용됩니다.
고해상도 이미지와 상세한 주석 덕분에 실시간 장면 파싱, 차선 및 장애물 이해, 복잡한 도시 환경에 대한 고밀도 픽셀 수준 이해가 필요한 모든 작업을 연구하는 데도 유용합니다. 사전 학습된 YOLO26 semantic segmentation 모델은 Cityscapes 검증 세트에서 최대 83.6 mIoU에 도달합니다. 전체 벤치마크 표는 semantic segmentation 모델 페이지를 참조하십시오. Ultralytics Platform을 사용하면 모델 개발 워크플로 전반에서 Cityscapes 데이터를 구성하고, 시각화하고, 관리할 수 있습니다.
데이터셋 YAML#
데이터셋 YAML 파일은 Cityscapes의 경로, 클래스, mask 디렉터리 및 레이블 매핑을 정의합니다. 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)사용법#
Cityscapes 데이터셋에서 이미지 크기 1024, 100 epochs로 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}
}자율주행 및 computer vision 커뮤니티를 위해 이 귀중한 리소스를 제작하고 유지 관리해 주신 Cityscapes 팀에 감사드립니다. Cityscapes 데이터셋과 제작자에 대한 자세한 내용은 Cityscapes 데이터셋 웹사이트를 방문하십시오.
FAQ#
Cityscapes 데이터셋은 유럽 50개 도시의 도시 거리 장면으로 구성된 대규모 semantic segmentation 벤치마크로, 자율주행 및 ADAS 연구에서 표준 참조 자료로 널리 사용됩니다. 정밀하게 주석 처리된 19개 평가 클래스, 고해상도 이미지, 표준화된 mean Intersection over Union(mIoU) 지표를 제공하므로 dense scene-understanding 모델을 위한 가장 많이 인용되는 벤치마크 중 하나입니다.
Cityscapes 데이터셋에서 이미지 크기 1024, 100 epochs로 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 label ID를 연속적인 표준 19개 train ID로 변환하며, 무시된 레이블과 void 레이블은255로 매핑합니다.testsplit의 마스크에는 ego-vehicle 및 경계 영역만 레이블되어 있으므로 로컬 mIoU 확인에는val을 사용하십시오.예. Cityscapes 웹사이트에서 계정을 만들고
leftImg8bit_trainvaltest.zip및gtFine_trainvaltest.zip아카이브(총 약 11GB)를 다운로드하십시오. 두 아카이브를 모두cityscapes데이터셋 루트에 압축 해제하면, 처음 학습을 시작할 때 Ultralytics가 자동으로 이를 예상되는images/및masks/레이아웃으로 재구성합니다.Cityscapes 원본 마스크에는 평가에 사용되는 19개 train ID와 다른 원본 label ID가 저장되어 있습니다.
label_mapping섹션은 유효한 레이블을 연속적인 클래스 ID0–18로 변환하고, 무시된 레이블과 void 레이블에는255을 할당하여 학습 및 검증 중 loss와 metric에서 제외합니다.아니요. Cityscapes는 학술 연구, 교육 및 평가를 허용하지만 데이터셋이나 파생 저작물의 상업적 사용, 라이선스 부여 또는 판매를 금지하는 non-commercial license에 따라 배포됩니다. 상업적 라이선스 옵션은 Cityscapes 팀에 직접 문의하십시오.