Cityscape是一個大型語義分割數據集,包含多種類型數據和處理代碼
github處理代碼地址:https://github.com/mcordts/cityscapesScripts
官方網站:https://www.cityscapes-dataset.com/ (推薦使用迅雷下載)
其他博主數據集下載地址:https://blog.csdn.net/zym19941119/article/details/81198315
Cityscape包含多種數據集,本文只關注gtFine/精細標註的語義分割部分,
gtFine部分的標註對應leftImg8bit的原始圖片:
gtFine數據集(無對應的Img) 下載鏈接:https://pan.baidu.com/s/1hWRDTnDD1uE29W2691x1xQ 提取碼:9tcd
gtFine數據集基本信息:
shape=(1024,2048,4)
標註包含
- 35個小類(name、id列,用於評測)
- 8大類(category、catId列,用於創建 ground truth)
- 20個train類(trainId列,官方提供,可根據需要調整)
可以在處理代碼 helpers / labels.py中查看對應標籤(可見本文末尾),labels.py中也包含了各種分類說明
gtFine文件結構:
train(aachen 174*4、bochum 96*4、bremen 316*4、cologne 154*4、darmstadt 85*4、dusseldorf 221*4、erfurt 109*4、hamburg 248*4、hanover 196*4、jena 119*4、krefeld 99*4、monchengladbach 94*4、strasbourg 365*4、stuttgart 196*4、tubingen 144*4、ulm 95*4、weimar 142*4、zurich 122*4),共2975*4個文件
val(frankfurt 267*4、lindau 59*4、munster 174*4),共500*4個文件
test(berlin 544*4、bielefeld 181*4、bonn 46*4、leverkusen 58*4、mainz 298*4、munich 398*4),共1525*4個文件
train、val單個樣本結構:
color、instanceIds、labelIds、polygons分別對應
彩色類別圖(用於可視化觀察)、實例分割ID、標籤ID(35小類)、邊界多邊形(35小類及對應邊界像素位置)
如果需要使用trainId分類編碼,可以直接調用preparation / createTrainIdLabelImgs.py,修改其中的路徑參數(data_path/cityscapesPath)即可生成(需要安裝pillow庫,部分版本安裝後運行此代碼報錯pillow未安裝,可以將helpers/chHelpers.py、preparation/json2labelImg.py 中的 from PIL import PILLOW_VERSION 改爲import PIL)
如果需要其他類別也可以根據代碼自行修改
test結構尚未研究
處理代碼結構:
helpers
: helper files that are included by other scripts labels.py包含標籤類別詳解viewer
: view the images and the annotationspreparation
: convert the ground truth annotations into a format suitable for your approach createTrainIdLabelImgs.py可以創建trainId類標籤圖像evaluation
: validate your approachannotation
: the annotation tool used for labeling the datasetdownload
: downloader for Cityscapes packages
labels = [
# name id trainId category catId hasInstances ignoreInEval color
Label( 'unlabeled' , 0 , 255 , 'void' , 0 , False , True , ( 0, 0, 0) ),
Label( 'ego vehicle' , 1 , 255 , 'void' , 0 , False , True , ( 0, 0, 0) ),
Label( 'rectification border' , 2 , 255 , 'void' , 0 , False , True , ( 0, 0, 0) ),
Label( 'out of roi' , 3 , 255 , 'void' , 0 , False , True , ( 0, 0, 0) ),
Label( 'static' , 4 , 255 , 'void' , 0 , False , True , ( 0, 0, 0) ),
Label( 'dynamic' , 5 , 255 , 'void' , 0 , False , True , (111, 74, 0) ),
Label( 'ground' , 6 , 255 , 'void' , 0 , False , True , ( 81, 0, 81) ),
Label( 'road' , 7 , 0 , 'flat' , 1 , False , False , (128, 64,128) ),
Label( 'sidewalk' , 8 , 1 , 'flat' , 1 , False , False , (244, 35,232) ),
Label( 'parking' , 9 , 255 , 'flat' , 1 , False , True , (250,170,160) ),
Label( 'rail track' , 10 , 255 , 'flat' , 1 , False , True , (230,150,140) ),
Label( 'building' , 11 , 2 , 'construction' , 2 , False , False , ( 70, 70, 70) ),
Label( 'wall' , 12 , 3 , 'construction' , 2 , False , False , (102,102,156) ),
Label( 'fence' , 13 , 4 , 'construction' , 2 , False , False , (190,153,153) ),
Label( 'guard rail' , 14 , 255 , 'construction' , 2 , False , True , (180,165,180) ),
Label( 'bridge' , 15 , 255 , 'construction' , 2 , False , True , (150,100,100) ),
Label( 'tunnel' , 16 , 255 , 'construction' , 2 , False , True , (150,120, 90) ),
Label( 'pole' , 17 , 5 , 'object' , 3 , False , False , (153,153,153) ),
Label( 'polegroup' , 18 , 255 , 'object' , 3 , False , True , (153,153,153) ),
Label( 'traffic light' , 19 , 6 , 'object' , 3 , False , False , (250,170, 30) ),
Label( 'traffic sign' , 20 , 7 , 'object' , 3 , False , False , (220,220, 0) ),
Label( 'vegetation' , 21 , 8 , 'nature' , 4 , False , False , (107,142, 35) ),
Label( 'terrain' , 22 , 9 , 'nature' , 4 , False , False , (152,251,152) ),
Label( 'sky' , 23 , 10 , 'sky' , 5 , False , False , ( 70,130,180) ),
Label( 'person' , 24 , 11 , 'human' , 6 , True , False , (220, 20, 60) ),
Label( 'rider' , 25 , 12 , 'human' , 6 , True , False , (255, 0, 0) ),
Label( 'car' , 26 , 13 , 'vehicle' , 7 , True , False , ( 0, 0,142) ),
Label( 'truck' , 27 , 14 , 'vehicle' , 7 , True , False , ( 0, 0, 70) ),
Label( 'bus' , 28 , 15 , 'vehicle' , 7 , True , False , ( 0, 60,100) ),
Label( 'caravan' , 29 , 255 , 'vehicle' , 7 , True , True , ( 0, 0, 90) ),
Label( 'trailer' , 30 , 255 , 'vehicle' , 7 , True , True , ( 0, 0,110) ),
Label( 'train' , 31 , 16 , 'vehicle' , 7 , True , False , ( 0, 80,100) ),
Label( 'motorcycle' , 32 , 17 , 'vehicle' , 7 , True , False , ( 0, 0,230) ),
Label( 'bicycle' , 33 , 18 , 'vehicle' , 7 , True , False , (119, 11, 32) ),
Label( 'license plate' , -1 , -1 , 'vehicle' , 7 , False , True , ( 0, 0,142) ),
]