Cityscapes annotation format
Polygon annotations of urban street scenes: a JSON file per image with a label and a polygon for each object, organised by split and city.
- Data
- Images
- Labels
- Polygons
- Files
.json, .png- Import / export
- Yes / Yes
What is the Cityscapes format?
Cityscapes is a large dataset for semantic understanding of urban street scenes: stereo video recorded in 50 cities, with fine pixel-level annotations of 5,000 frames and 20,000 more frames with coarse annotations.
Images are leftImg8bit PNG files and fine annotations are gtFine JSON files, both in train, val and test folders and then a folder per city. An annotation lists imgHeight, imgWidth and objects, each with a label and a polygon of [x, y] points.
Folder structure and an example
project
├── gtFine
│ ├── train
│ │ └── ds1
│ │ └── IMG_1836_gtFine_polygons.json
│ └── val
│ └── ds1
│ └── IMG_0748_gtFine_polygons.json
├── leftImg8bit
│ ├── train
│ │ └── ds1
│ │ └── IMG_1836_leftImg8bit.png
│ └── val
│ └── ds1
│ └── IMG_0748_leftImg8bit.png
└── class_to_id.json{
"imgHeight": 800,
"imgWidth": 1067,
"objects": [
{
"label": "lemon",
"polygon": [[772, 421], [1009, 470], [985, 588], [760, 540]]
}
]
}[
{ "name": "kiwi", "id": 1, "color": [255, 0, 0] },
{ "name": "lemon", "id": 2, "color": [81, 198, 170] }
]Import and export Cityscapes in Supervisely
Import Cityscapes into Supervisely
- Import data (Auto Import)
Reads images with the
_leftImg8bitsuffix and annotations with_gtFine_polygons.json;class_to_id.jsonsets custom classes and colors. - Import Cityscapes
Imports a folder or archive from Team Files and tags the images
train,valortestby their folder.
Export from Supervisely to Cityscapes
- Export to Cityscapes
Exports polygon and bitmap classes to
gtFineandleftImg8bitwithclass_to_id.json. Holes are filled, and a bitmap of separate parts becomes separate objects.
All apps are in the Ecosystem, under Import and Export. Every project is stored in Supervisely JSON in between.
Converting Cityscapes to and from Supervisely JSON
| Cityscapes | Supervisely JSON | Notes |
|---|---|---|
objects[].label | class title | |
objects[].polygon | polygon exterior | Cityscapes polygons have no holes. |
train, val, test folders | image tags train, val, test | Without tags the export splits the images 60% train, 20% val, 20% test. |
| city folder | dataset | |
polygon | bitmap | On export, a bitmap becomes polygons, one per connected part. |
class_to_id.json | classes and colors in meta.json | Written by the export, since Supervisely classes can have any name and color. |