Convert Supervisely
to COCO

Exporting a Supervisely project to COCO gets your labels into the format most detection and segmentation libraries read.

Format differences

Supervisely vs COCO

COCO, named after the Common Objects in Context dataset, keeps a whole dataset in one JSON file: a list of images, a list of annotations and a list of categories. A Supervisely project holds every shape the platform can draw, so the conversion is about what COCO can hold.

SuperviselyCOCO
Annotation filesOne JSON file per image (ann/<image>.json) in each dataset folder, and one meta.json for the project.One JSON file per dataset (annotations/instances.json) that lists images, annotations and categories.
CoordinatesAbsolute pixels; a rectangle is stored as its top-left and bottom-right points.Absolute pixels; bbox is [x, y, width, height], measured from the top-left corner.
ShapesRectangles, polygons, polylines, points, bitmap masks, keypoint graphs, alpha masks and 2D cuboids.Boxes, polygons or RLE masks, keypoints and image captions.
ClassesClasses are defined in meta.json with a name, a shape and a colour; tags can sit on images and on objects.A categories list with numeric ids; every annotation points to one with its category_id.

What the conversion changes

Export to COCO

  • Polygons, rectangles and bitmap masks become COCO polygons with boxes; keypoint graphs become COCO keypoints.
  • Holes are not kept: Export to COCO mask keeps holes and exports polylines.
  • Every dataset gets its own instances.json, with image and annotation ids starting at 1.
Workflow

Convert Supervisely to COCO 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 COCO.

  3. 03

    Export to COCO

    Open the menu of the project, choose Download via app and run Export to COCO. 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 Python SDK writes COCO from a Supervisely project on your disk, with no server involved. A project on the platform is downloaded first with sly.download_fast.

Install it with pip install supervisely.

SDK export tutorial
convert.py
import supervisely as sly

# A Supervisely project on disk: meta.json and a folder per dataset
sly.convert.project_to_coco("sly_project", "coco", copy_images=True)

Frequently asked questions.

Can I convert Supervisely to COCO 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 COCO. Both start from the Supervisely web interface.

What changes when Supervisely becomes COCO?

Polygons, rectangles and bitmap masks become COCO polygons with boxes; keypoint graphs become COCO keypoints. Holes are not kept: Export to COCO mask keeps holes and exports polylines. Every dataset gets its own instances.json, with image and annotation ids starting at 1.

Does COCO 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. COCO: Absolute pixels; bbox is [x, y, width, height], measured from the top-left corner.

How do Supervisely classes carry over to COCO?

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 COCO: a categories list with numeric ids; every annotation points to one with its category_id. 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 COCO in Python?

The Python SDK writes COCO from a Supervisely project on your disk, with no server involved. A project on the platform is downloaded first with sly.download_fast. See the SDK export tutorial.