Supervisely JSON format

The native annotation format of Supervisely: a meta.json with classes and tags, and one JSON file per image, video, point cloud or volume, with the same structure for every project.

Overview

Supervisely JSON is the format the platform stores and exports data in. It covers images, videos, point clouds, point cloud episodes and volumes, and its structure is the same for every kind of project: a project is a folder with a meta.json file of classes, tags and settings, and a folder per dataset with the source files and one JSON annotation per item.

Since it supports every capability of the platform, it is the recommended way to download a project: nothing is lost, however complex the annotations. This page follows the Supervisely .JSON Format section of the documentation, with its examples.

Project structure

A downloaded project is a project_name.tar archive. Inside it, every dataset folder holds the source media and an ann folder with an annotation file named after each item, such as pexels-photo-101063.png.json.

Image project on disk
project-name
├── dataset-name-001
│   ├── ann
│   │   ├── pexels-photo-101063.png.json
│   │   └── pexels-photo-103127.png.json
│   ├── img
│   │   ├── pexels-photo-101063.png
│   │   └── pexels-photo-103127.png
│   ├── img_info
│   │   ├── pexels-photo-101063.png.json
│   │   └── pexels-photo-103127.png.json
│   └── meta
│       ├── pexels-photo-101063.png.json
│       └── pexels-photo-103127.png.json
├── dataset-name-002
│   ├── ann
│   └── img
└── meta.json
  • meta.json: the classes, tags, project type and settings of the project.
  • ann: an annotation file per item, named item_name.json.
  • img, video, pointcloud or volume: the source media. A download can include annotations only.
  • img_info: JSON files with the ImageInfo of each image on the instance.
  • meta (optional): JSON files with the metadata of each image.
  • key_id_map.json (optional): created when annotating in Supervisely; maps the keys of items, objects and figures to their IDs on the server. Manual annotations do not need it.
  • obj_class_to_machine_color.json, masks_human, masks_machine, masks_instances (optional): written by the Export as masks app.
  • blob and *_offsets.pkl (optional): TAR files that pack many small images, with the offset of each image, for faster uploads and downloads.

meta.json: classes, tags and settings

meta.json is the Project Meta: the classes and tags that every dataset of the project can use, the type of the project and the settings of its labeling interface.

meta.json
{
  "classes": [
    {
      "title": "bike",
      "shape": "rectangle",
      "color": "#F6FF00",
      "geometry_config": {},
      "id": 6509759,
      "hotkey": ""
    },
    {
      "title": "car",
      "shape": "polygon",
      "color": "#BE55CE",
      "geometry_config": {},
      "id": 6509764,
      "hotkey": ""
    },
    {
      "title": "person",
      "shape": "bitmap",
      "color": "#00FF12",
      "geometry_config": {},
      "id": 6509777,
      "hotkey": ""
    }
  ],
  "tags": [
    {
      "name": "cars_number",
      "color": "#A0A08C",
      "value_type": "any_number",
      "id": 27855,
      "hotkey": "",
      "applicable_type": "all",
      "classes": []
    },
    {
      "name": "like",
      "color": "#D98F7E",
      "value_type": "none",
      "id": 27856,
      "hotkey": "",
      "applicable_type": "all",
      "classes": []
    },
    {
      "name": "situated",
      "color": "#855D79",
      "value_type": "oneof_string",
      "values": ["inside", "outside"],
      "id": 27857,
      "hotkey": "",
      "applicable_type": "all",
      "classes": []
    },
    {
      "name": "car_color",
      "color": "#ED68A1",
      "value_type": "any_string",
      "id": 27858,
      "hotkey": "",
      "applicable_type": "all",
      "classes": ["car"]
    }
  ],
  "projectType": "images",
  "projectSettings": {
    "multiView": {
      "enabled": true,
      "tagName": "cars_number",
      "tagId": null,
      "isSynced": false
    }
  }
}
FieldMeaning
classes[].titleThe unique name of the class; objects refer to it by classTitle.
classes[].shapeThe geometry of the class, such as rectangle, polygon, bitmap or graph.
classes[].colorA hex color.
classes[].geometry_configOptional settings of the geometry, used with keypoints.
tags[].name, value_typeThe unique name of the tag and its type: none, any_number, any_string, oneof_string or date.
tags[].valuesThe allowed values of a oneof_string tag.
tags[].applicable_typeimagesOnly, objectsOnly or all (the default).
tags[].classesLimits the tag to these classes.
projectTypeimages, videos, volumes, point_clouds or point_cloud_episodes.
projectSettingsOptional settings, such as the multi-view mode and its group tag.

Image annotation

Each image has its annotation in ann/image_name.image_format.json: its size, an optional description, the image tags and the objects on it.

ann/tomatoes-eggs-dish.jpg.json
{
  "description": "",
  "name": "tomatoes-eggs-dish.jpg",
  "size": {
    "height": 952,
    "width": 1200
  },
  "tags": [
    {
      "id": 86458968,
      "tagId": 28283798,
      "name": "situated",
      "value": "outside",
      "labelerLogin": "alexxx",
      "createdAt": "2020-08-26T09:07:26.408Z",
      "updatedAt": "2020-08-26T09:07:26.408Z"
    }
  ],
  "objects": [
    {
      "id": 497521358,
      "classId": 1661574,
      "description": "",
      "geometryType": "rectangle",
      "labelerLogin": "alexxx",
      "createdAt": "2020-08-07T11:09:51.054Z",
      "updatedAt": "2020-08-07T11:09:51.054Z",
      "nnCreated": false,
      "nnUpdated": false,
      "tags": [],
      "classTitle": "bike",
      "points": {
        "exterior": [[0, 236], [582, 872]],
        "interior": []
      }
    }
  ]
}
  • name: the image name; size: width and height in pixels, to work with the annotation without reading the image.
  • description (optional): text assigned to the image.
  • tags: the tags of the image; objects: the labeled objects.

Objects and coordinates

On images and video frames, all values are in pixels, counted from the top-left corner of the image, as in NumPy. Every point is a list of two numbers in the order [x, y]: column, then row. Shapes made of points keep them in points: exterior is the outline, and interior lists the holes of a polygon and stays empty for other shapes.

Every object has a geometryType, the classTitle of its class in meta.json, its tags and an optional description. The fields id, classId, labelerLogin, createdAt and updatedAt are filled in by the platform and can be left out of files written by hand; nnCreated and nnUpdated say whether a neural network created or corrected the object.

Rectangle

exterior is [[left, top], [right, bottom]]; interior is always empty.

{
  "description": "",
  "geometryType": "rectangle",
  "tags": [],
  "classTitle": "person_bbox",
  "points": {
    "exterior": [[533, 63], [800, 830]],
    "interior": []
  }
}

Polygon with a hole

exterior is the outline; each list in interior is a hole.

{
  "description": "",
  "geometryType": "polygon",
  "tags": [],
  "classTitle": "triangle_hole",
  "points": {
    "exterior": [[730, 2104], [2479, 402], [3746, 1646]],
    "interior": [
      [[1907, 1255], [2468, 875], [2679, 1577]]
    ]
  }
}

Polyline

The shape is called line; interior is always empty.

{
  "description": "",
  "geometryType": "line",
  "tags": [],
  "classTitle": "line",
  "points": {
    "exterior": [[211, 2266], [1208, 1310], [369, 981]],
    "interior": []
  }
}

Point

A single [x, y] in exterior.

{
  "description": "",
  "geometryType": "point",
  "tags": [],
  "classTitle": "point",
  "points": {
    "exterior": [[1334, 907]],
    "interior": []
  }
}

Bitmap

origin is the top-left corner of the mask in the image; data is the mask as a zlib-compressed, base64-encoded PNG.

{
  "description": "",
  "geometryType": "bitmap",
  "tags": [],
  "classTitle": "person",
  "bitmap": {
    "data": "eJwB ... kUnW",
    "origin": [535, 66]
  }
}

Keypoints (graph)

nodes maps the id of each vertex to its loc. The geometry_config of the class in meta.json can hold the keypoint template.

{
  "description": "",
  "geometryType": "graph",
  "tags": [],
  "classTitle": "graph",
  "nodes": {
    "8e20c830-ee86-450f-9d21-833eec53e3c5": { "loc": [1017, 1556] },
    "bf89e248-7b3b-4732-888a-99d3369fbb2f": { "loc": [1024, 394] },
    "66502c5b-8d98-492c-bb48-8ce7c4487038": { "loc": [1026, 738] }
  }
}

To read and write the data of a bitmap, the docs give two Python helpers:

bitmap data to a NumPy mask and back
import base64, io, zlib
import cv2
import numpy as np
from PIL import Image

def base64_2_mask(s):
    z = zlib.decompress(base64.b64decode(s))
    n = np.frombuffer(z, np.uint8)
    mask = cv2.imdecode(n, cv2.IMREAD_UNCHANGED)[:, :, 3].astype(bool)
    return mask

def mask_2_base64(mask):
    img_pil = Image.fromarray(np.array(mask, dtype=np.uint8))
    img_pil.putpalette([0, 0, 0, 255, 255, 255])
    bytes_io = io.BytesIO()
    img_pil.save(bytes_io, format="PNG", transparency=0, optimize=0)
    return base64.b64encode(zlib.compress(bytes_io.getvalue())).decode("utf-8")

All shapes

geometryTypeGeometry keyWhat it is
pointpointsA single point.
rectanglepointsAn axis-aligned box: [[left, top], [right, bottom]].
oriented_bboxpoints, angleA box rotated clockwise by angle in radians; points is the box before rotation.
polygonpointsAn outline in exterior, holes in interior.
multipolygonpartsSeveral polygon parts as one object, each with exterior and interior.
linepointsA polyline.
bitmapbitmapA mask: origin and the encoded data.
alpha_maskbitmapA grayscale mask, stored like a bitmap.
graphnodesKeypoints: named vertices with their loc.
cuboid_2dverticesA 2D cuboid of eight named vertices.
cuboid_3dgeometryA 3D box in point clouds: position, rotation, dimensions.
mask_3dgeometryA 3D mask of a volume, its data in an NRRD file.

Tags

Tags add information to an image, a video, a frame or an object. A tag is attached to one item or object once, and the same tag can be attached to many. In an annotation, a tag is its name and value; id, tagId, labelerLogin, createdAt and updatedAt are filled in by the platform. A tag can also carry any JSON in customData.

An object tag
{
  "id": 95462538,
  "tagId": 28256201,
  "labelerLogin": "alexxx",
  "createdAt": "2020-07-24T07:30:39.202Z",
  "updatedAt": "2020-07-24T07:30:39.202Z",
  "name": "car_color",
  "value": "red"
}
value_typeValue
nonenull: the tag has no value.
any_numberA number.
any_stringA string.
oneof_stringOne of the values listed in meta.json.
dateAn ISO 8601 date and time, such as 2026-04-23T15:15:48.

Video annotation

A video has its annotation in video_name.video_format.json. Objects are declared once for the whole video in objects; frames lists only the frames that have labels, and each figure of a frame points to its object by objectKey. Keys are unique strings, and key_id_map.json maps them to the IDs on the server.

video annotation
{
  "size": {
    "height": 1080,
    "width": 1920
  },
  "description": "",
  "key": "c8168b43ae1b45c38930f456df9d0f2b",
  "tags": [],
  "objects": [
    {
      "key": "198f727d40c749eebcacc4aed299b39a",
      "classTitle": "rect",
      "tags": [],
      "labelerLogin": "alexxx",
      "updatedAt": "2020-08-23T12:06:11.963Z",
      "createdAt": "2020-08-23T12:06:11.963Z"
    }
  ],
  "frames": [
    {
      "index": 0,
      "figures": [
        {
          "key": "65f21690780e43b49863c3cbd07eab3a",
          "objectKey": "198f727d40c749eebcacc4aed299b39a",
          "geometryType": "rectangle",
          "geometry": {
            "points": {
              "exterior": [[266, 420], [847, 845]],
              "interior": []
            }
          },
          "labelerLogin": "alexxx",
          "updatedAt": "2020-08-23T12:06:13.544Z",
          "createdAt": "2020-08-23T12:06:13.544Z",
          "nnCreated": false,
          "nnUpdated": false
        }
      ]
    }
  ],
  "framesCount": 375
}
key_id_map.json
{
  "tags": {},
  "objects": {
    "198f727d40c749eebcacc4aed299b39a": 20520
  },
  "figures": {
    "65f21690780e43b49863c3cbd07eab3a": 503130811
  },
  "videos": {
    "c8168b43ae1b45c38930f456df9d0f2b": 157876296
  }
}

Point clouds and point cloud episodes

A point cloud project keeps .pcd files in pointcloud, an annotation per point cloud in ann and the photo context, camera images with their calibration, in related_images. Coordinates are in metres. A cuboid_3d has a position (its centre: x forward, y left, z up), dimensions (x width, y length, z height) and a rotation (x pitch, y roll, z yaw) in radians between −π and π.

Point cloud project on disk
pointcloud_project
├── key_id_map.json          (optional)
├── meta.json
└── dataset1
    ├── pointcloud
    │   ├── scene_1.pcd
    │   └── scene_2.pcd
    ├── related_images
    │   └── scene_1_pcd
    │       ├── scene_1_cam0.png
    │       └── scene_1_cam0.png.json
    └── ann
        ├── scene_1.pcd.json
        └── scene_2.pcd.json
ann/scene_1.pcd.json
{
  "description": "",
  "key": "e9f0a3ae21be41d08eec166d454562be",
  "tags": [],
  "objects": [
    {
      "key": "ecb975d70735486b90fe4fdd2be77e3b",
      "classTitle": "Car",
      "tags": []
    }
  ],
  "figures": [
    {
      "key": "abbaec8785c1468585f6210c62bb2374",
      "objectKey": "ecb975d70735486b90fe4fdd2be77e3b",
      "geometryType": "cuboid_3d",
      "geometry": {
        "position": { "x": 58.756710052490234, "y": 4.623323917388916, "z": -0.4174150526523591 },
        "rotation": { "x": 0, "y": 0, "z": -1.77 },
        "dimensions": { "x": 1.59, "y": 4.28, "z": 1.45 }
      }
    }
  ]
}

An episode is a sequence of point clouds, one dataset per episode. Its whole annotation is a single annotation.json with objects shared by every frame, and frame_pointcloud_map.json gives the order of the point cloud files.

Point cloud episodes project on disk
project_name
├── meta.json
├── key_id_map.json
└── dataset_name             (one episode)
    ├── annotation.json
    ├── frame_pointcloud_map.json
    ├── pointcloud
    │   ├── frame1.pcd
    │   └── frame2.pcd
    └── related_images       (optional)
        └── frame1
            ├── 1.png
            └── 1.png.json
frame_pointcloud_map.json
{
  "0": "frame1.pcd",
  "1": "frame2.pcd",
  "2": "frame3.pcd"
}
annotation.json
[
  {
    "description": "",
    "key": "e9f0a3ae21be41d08eec166d454562be",
    "tags": [],
    "objects": [
      {
        "key": "6663ca1d20c74bea83bd48c24568989d",
        "classTitle": "car",
        "tags": []
      }
    ],
    "framesCount": 48,
    "frames": [
      {
        "index": 0,
        "figures": [
          {
            "key": "cb8e067dadfc423aa8575a0c4e62de33",
            "objectKey": "6663ca1d20c74bea83bd48c24568989d",
            "geometryType": "cuboid_3d",
            "geometry": {
              "position": { "x": -10.863547325134277, "y": -93.57706451416016, "z": -4.598618030548096 },
              "rotation": { "x": 0, "y": 0, "z": 3.250733629393711 },
              "dimensions": { "x": 1.978, "y": 4.607, "z": 1.552 }
            }
          }
        ]
      }
    ]
  }
]

Volumes: DICOM and NRRD

Volumes are stored as NRRD files in volume, and DICOM series are converted to NRRD on import. An annotation has the volumeMeta needed to rebuild the volume in 3D (its anatomical coordinate system, intensity range, window, dimensions and the IJK-to-world matrix), the 2D figures on slices of the axial, coronal and sagittal planes, and the 3D figures in spatialFigures. The data of every mask_3d is an NRRD file in mask, named after the key of its figure.

Volume project on disk
project_name
├── meta.json
├── key_id_map.json          (optional)
└── dataset_name
    ├── volume
    │   └── CTChest.nrrd
    ├── ann
    │   └── CTChest.nrrd.json
    └── mask                 (created on download)
        └── CTChest.nrrd
            └── daff638a423a4bcfa34eb12e42243a87.nrrd
ann/CTChest.nrrd.json
{
  "volumeMeta": {
    "ACS": "RAS",
    "intensity": { "max": 3071, "min": -3024 },
    "windowWidth": 6095,
    "rescaleSlope": 1,
    "windowCenter": 23.5,
    "channelsCount": 1,
    "dimensionsIJK": { "x": 512, "y": 512, "z": 139 },
    "IJK2WorldMatrix": [
      0.7617189884185793, 0, 0, -194.238403081894,
      0, 0.7617189884185793, 0, -217.5384061336518,
      0, 0, 2.5, -347.7500000000001,
      0, 0, 0, 1
    ],
    "rescaleIntercept": 0
  },
  "key": "bfed5ee444d849118d7aabc350248cb8",
  "tags": [],
  "objects": [
    { "key": "f1f495a8e0a64fd7a63efbd78af8ef56", "classTitle": "lung_bitmap", "tags": [] },
    { "key": "6c1587f381bf419e9d5c2ebd5967e28f", "classTitle": "lung_mask3d", "tags": [] }
  ],
  "planes": [
    {
      "name": "axial",
      "normal": { "x": 0, "y": 0, "z": 1 },
      "slices": [
        {
          "index": 51,
          "figures": [
            {
              "key": "4c68e29372ef4e3a9c87a233ffabd3dd",
              "objectKey": "f1f495a8e0a64fd7a63efbd78af8ef56",
              "geometryType": "bitmap",
              "geometry": {
                "bitmap": { "data": "eJwBp ... AADUlIRFIAAACeA==", "origin": [156, 275] }
              }
            }
          ]
        }
      ]
    }
  ],
  "spatialFigures": [
    {
      "key": "daff638a423a4bcfa34eb12e42243a87",
      "objectKey": "6c1587f381bf419e9d5c2ebd5967e28f",
      "geometryType": "mask_3d",
      "geometry": {
        "mask_3d": { "data": "H4sIAGW9OmUC ... CYAE1Nj5QMACwC", "space_origin": [194, 218, -348] },
        "shape": "mask_3d",
        "geometryType": "mask_3d"
      }
    }
  ]
}

More on the files of medical data on the DICOM, NRRD and NIfTI page.

Import, export and the Python SDK

To download a project in Supervisely format, open its menu and choose Download; the app saves an archive to Team Files and gives a link on the Tasks page. These apps import and export the format for each kind of project:

Import

Export

In code, the Python SDK reads and writes projects in this format and converts them; the developer portal describes the annotation format for SDK users too.

Download a project and convert it
import supervisely as sly

api = sly.Api.from_env()
sly.Project.download(api, project_id, "./sly_project", log_progress=True)

# Convert the downloaded project to other formats
sly.convert.project_to_coco("./sly_project", "./result_coco")
sly.convert.project_to_yolo("./sly_project", "./result_yolo")
sly.convert.project_to_pascal_voc("./sly_project", "./result_pascal")

Convert Supervisely JSON to and from other formats

Each page shows the folder structure of a format and how its parts map to Supervisely JSON.

Sources