Convert Supervisely
to Cityscapes

Exporting a Supervisely project to Cityscapes gets your labels into the layout semantic segmentation code built for the Cityscapes benchmark expects.

Format differences

Supervisely vs Cityscapes

Cityscapes, the format of the urban street-scene benchmark, stores the polygons of each image in a _gtFine_polygons.json file next to its _leftImg8bit image. A Supervisely project holds every shape the platform can draw, so the conversion is about what Cityscapes can hold.

SuperviselyCityscapes
Annotation filesOne JSON file per image (ann/<image>.json) in each dataset folder, and one meta.json for the project.One _gtFine_polygons.json per image, next to the _leftImg8bit image, in split and city folders.
CoordinatesAbsolute pixels; a rectangle is stored as its top-left and bottom-right points.Absolute pixels; every object is a polygon point list.
ShapesRectangles, polygons, polylines, points, bitmap masks, keypoint graphs, alpha masks and 2D cuboids.Polygons (the fine annotations, gtFine).
ClassesClasses are defined in meta.json with a name, a shape and a colour; tags can sit on images and on objects.Each object carries a label name; class_to_id.json gives custom classes their ids and colours.

What the conversion changes

Export to Cityscapes

  • Only polygons and bitmaps are exported: Convert Class Shape turns boxes into polygons first.
  • Holes are filled, and a mask in several separate pieces becomes several objects.
  • Class names, colours and ids go to class_to_id.json; without split tags the images are split 60/20/20 into train, val and test.
Workflow

Convert Supervisely to Cityscapes in three steps

  1. 01

    Import Supervisely

    Upload the project folder or archive to Supervisely and run Import images in Supervisely format from the Ecosystem: it creates a project with the images and labels (Supervisely import guide).

  2. 02

    Review in the labeling toolbox

    Open the project in the image labeling toolbox to check classes and fix labels before they go to Cityscapes.

  3. 03

    Export to Cityscapes

    Open the menu of the project, choose Download via app and run Export to Cityscapes. The archive appears in Tasks and Team Files.

Run this conversion on your own data in a free account, or let us walk your team through it.

Python SDK

Or in a few lines of Python

The SDK has no Cityscapes writer: it uploads a Supervisely project from your disk, and the export app does the rest.

Install it with pip install supervisely.

SDK export tutorial
convert.py
import supervisely as sly

# SERVER_ADDRESS and API_TOKEN come from the environment
api = sly.Api.from_env()
project_id, name = sly.Project.upload("sly_project", api, workspace_id=123)
# Then run Export to Cityscapes on this project

Frequently asked questions.

Can I convert Supervisely to Cityscapes without code?

Yes. Import the data with Import images in Supervisely format, check it in the image labeling toolbox, then export it with Export to Cityscapes. Both start from the Supervisely web interface.

What changes when Supervisely becomes Cityscapes?

Only polygons and bitmaps are exported: Convert Class Shape turns boxes into polygons first. Holes are filled, and a mask in several separate pieces becomes several objects. Class names, colours and ids go to class_to_id.json; without split tags the images are split 60/20/20 into train, val and test.

Does Cityscapes use the same coordinates as Supervisely?

Both use absolute pixel coordinates, written differently. Supervisely: Absolute pixels; a rectangle is stored as its top-left and bottom-right points. Cityscapes: Absolute pixels; every object is a polygon point list.

How do Supervisely classes carry over to Cityscapes?

In Supervisely: classes are defined in meta.json with a name, a shape and a colour; tags can sit on images and on objects. In Cityscapes: each object carries a label name; class_to_id.json gives custom classes their ids and colours. The class names stay the same on the way through Supervisely, so rename or merge classes in the project before you export.

Can I convert Supervisely to Cityscapes in Python?

The SDK has no Cityscapes writer: it uploads a Supervisely project from your disk, and the export app does the rest. See the SDK export tutorial.