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
The format

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.

Files

Folder structure and an example

Folder structure for import
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
gtFine/train/ds1/IMG_1836_gtFine_polygons.json
{
  "imgHeight": 800,
  "imgWidth": 1067,
  "objects": [
    {
      "label": "lemon",
      "polygon": [[772, 421], [1009, 470], [985, 588], [760, 540]]
    }
  ]
}
class_to_id.json
[
  { "name": "kiwi", "id": 1, "color": [255, 0, 0] },
  { "name": "lemon", "id": 2, "color": [81, 198, 170] }
]
In and out

Import and export Cityscapes in Supervisely

Import Cityscapes into Supervisely

  • Import data (Auto Import)

    Reads images with the _leftImg8bit suffix and annotations with _gtFine_polygons.json; class_to_id.json sets custom classes and colors.

  • Import Cityscapes

    Imports a folder or archive from Team Files and tags the images train, val or test by their folder.

Export from Supervisely to Cityscapes

  • Export to Cityscapes

    Exports polygon and bitmap classes to gtFine and leftImg8bit with class_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.

Conversion

Converting Cityscapes to and from Supervisely JSON

CityscapesSupervisely JSONNotes
objects[].labelclass title
objects[].polygonpolygon exteriorCityscapes polygons have no holes.
train, val, test foldersimage tags train, val, testWithout tags the export splits the images 60% train, 20% val, 20% test.
city folderdataset
polygonbitmapOn export, a bitmap becomes polygons, one per connected part.
class_to_id.jsonclasses and colors in meta.jsonWritten by the export, since Supervisely classes can have any name and color.