Cityscapes 데이터셋
Cityscapes 데이터셋은 유럽 50개 도시의 도심 거리 풍경을 담은 대규모 semantic segmentation 벤치마크입니다. 이 데이터셋은 고품질의 픽셀 단위 주석을 제공하며, Ultralytics YOLO 모델을 활용한 자율 주행 연구 및 도시 환경 이해 분야에서 가장 널리 사용되는 데이터셋 중 하나입니다.
주요 특징
- Cityscapes의 상세 주석은 2,975개의 학습 이미지, 500개의 검증 이미지, 1,525개의 테스트 이미지로 구성되어 있습니다.
- 이 데이터셋은 도로, 차량, 사람, 건설물, 사물, 자연, 하늘 등 19개의 평가 클래스를 포함합니다.
- Cityscapes는 semantic segmentation을 위한 mean Intersection over Union(mIoU)과 같은 표준화된 평가 지표를 제공하여 모델 성능을 효과적으로 비교할 수 있게 합니다.
데이터셋 구조
Ultralytics 설정에서는 데이터 준비 후 다음과 같은 레이아웃을 요구합니다:
cityscapes/
├── images/
│ ├── train/
│ ├── val/
│ └── test/
└── masks/
├── train/
├── val/
└── test/semantic mask는 단일 채널 PNG 파일입니다. 원본 Cityscapes 라벨 ID는 label_mapping 섹션을 통해 표준 19개 학습 ID로 매핑되며, 무시되거나 void로 처리된 라벨은 255로 매핑되어 학습 및 평가에서 제외됩니다. Cityscapes 웹사이트에서 공식 leftImg8bit 및 gtFine 아카이브를 다운로드하여 데이터셋 루트에 압축을 푼 다음, cityscapes.yaml의 준비 블록을 사용해 이미지와 마스크를 해당 레이아웃으로 정리하십시오.
응용 분야
Cityscapes는 semantic segmentation 분야에서 deep learning 모델을 학습 및 평가하는 데 널리 사용되며, 특히 autonomous driving, 첨단 운전자 보조 시스템(ADAS), 도시 로봇 공학 연구에 활용됩니다.
고해상도 이미지와 상세한 주석 덕분에 실시간 장면 파싱, 차선 및 장애물 인식, 복잡한 도시 환경에 대한 밀도 높은 픽셀 단위 이해가 필요한 모든 작업 연구에 유용합니다.
데이터셋 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)사용법
Cityscapes 데이터셋에서 YOLO26n-sem 모델을 이미지 크기 1024로 100 epochs 동안 학습하려면 다음 코드 스니펫을 사용할 수 있습니다. 사용 가능한 인자 전체 목록은 모델 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 데이터셋을 사용하는 경우, 다음 논문을 인용해 주십시오:
@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 데이터셋 웹사이트를 방문하십시오.
자주 묻는 질문(FAQ)
Cityscapes 데이터셋은 무엇이며 컴퓨터 비전 분야에서 왜 중요한가요?
Cityscapes 데이터셋은 유럽 50개 도시의 도심 거리 풍경을 담은 대규모 semantic segmentation 벤치마크입니다. 19개 평가 클래스에 걸쳐 5,000개의 상세 주석이 달린 이미지를 포함하고 있어 자율 주행 및 도시 환경 이해 연구의 기반이 되는 자원입니다. 고해상도 이미지, 밀도 높은 주석, 표준화된 mIoU 지표 덕분에 밀집 예측 모델을 벤치마킹하는 데 이상적입니다.
Cityscapes 데이터셋을 사용하여 YOLO 모델을 어떻게 학습하나요?
Cityscapes 데이터셋에서 YOLO26n-sem 모델을 이미지 크기 1024로 100 에포크 동안 학습하려면 다음 코드 스니펫을 사용할 수 있습니다. 사용 가능한 인자들에 대한 상세 목록은 모델 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 데이터셋은 어떻게 구성되어 있나요?
데이터 준비가 완료되면 데이터셋은 images/{train,val,test}/ 및 masks/{train,val,test}/ 디렉토리로 구성되며, 각 이미지는 단일 채널 PNG 마스크와 쌍을 이룹니다. Ultralytics YAML 파일은 masks_dir: masks 필드를 통해 각 이미지와 마스크를 연결하며, label_mapping을 사용하여 원본 Cityscapes 라벨 ID를 표준 19개의 연속된 학습 ID로 변환하고, 무시되거나 void인 라벨은 255로 매핑합니다.
Cityscapes를 직접 다운로드해야 하나요?
Yes. Cityscapes requires accepting the dataset terms on the official website. Download and extract leftImg8bit and gtFine into the cityscapes dataset root before using the preparation block in cityscapes.yaml to create the expected images/ and masks/ layout.
Cityscapes는 왜 label_mapping을 사용하나요?
Cityscapes 소스 마스크는 평가에 사용되는 19개의 학습 ID와는 다른 원본 라벨 ID를 저장하고 있습니다. label_mapping 섹션은 유효한 라벨을 연속적인 클래스 ID 0–18로 변환하며, 무시되거나 void인 라벨에는 255를 할당하여 학습 및 검증 시 손실 계산 및 지표에서 제외되도록 합니다.