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