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.
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.jsonmeta.json: the classes, tags, project type and settings of the project.ann: an annotation file per item, nameditem_name.json.img,video,pointcloudorvolume: the source media. A download can include annotations only.img_info: JSON files with theImageInfoof 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.bloband*_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.
{
"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
}
}
}| Field | Meaning |
|---|---|
classes[].title | The unique name of the class; objects refer to it by classTitle. |
classes[].shape | The geometry of the class, such as rectangle, polygon, bitmap or graph. |
classes[].color | A hex color. |
classes[].geometry_config | Optional settings of the geometry, used with keypoints. |
tags[].name, value_type | The unique name of the tag and its type: none, any_number, any_string, oneof_string or date. |
tags[].values | The allowed values of a oneof_string tag. |
tags[].applicable_type | imagesOnly, objectsOnly or all (the default). |
tags[].classes | Limits the tag to these classes. |
projectType | images, videos, volumes, point_clouds or point_cloud_episodes. |
projectSettings | Optional 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.
{
"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:widthandheightin 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:
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
geometryType | Geometry key | What it is |
|---|---|---|
point | points | A single point. |
rectangle | points | An axis-aligned box: [[left, top], [right, bottom]]. |
oriented_bbox | points, angle | A box rotated clockwise by angle in radians; points is the box before rotation. |
polygon | points | An outline in exterior, holes in interior. |
multipolygon | parts | Several polygon parts as one object, each with exterior and interior. |
line | points | A polyline. |
bitmap | bitmap | A mask: origin and the encoded data. |
alpha_mask | bitmap | A grayscale mask, stored like a bitmap. |
graph | nodes | Keypoints: named vertices with their loc. |
cuboid_2d | vertices | A 2D cuboid of eight named vertices. |
cuboid_3d | geometry | A 3D box in point clouds: position, rotation, dimensions. |
mask_3d | geometry | A 3D mask of a volume, its data in an NRRD file. |
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.
{
"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
}{
"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 π.
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{
"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.
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{
"0": "frame1.pcd",
"1": "frame2.pcd",
"2": "frame3.pcd"
}[
{
"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.
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{
"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
- Import data (Auto Import) Recognises a project in Supervisely format dropped into a new project, as it does other formats.
- Import images in Supervisely format Image projects, including the blob variant for many small images.
- Import videos in Supervisely format Video projects.
- Import Point Cloud Project Point cloud projects with photo context.
- Import Point Cloud Episodes Point cloud episodes.
- Import Volumes in Supervisely format NRRD volumes with their annotations and masks.
Export
- Export to Supervisely format Image projects, from Download in the menu of a project or dataset.
- Export to Supervisely Blob Image projects with blob files and offsets, for fast transfers of many small images.
- Export videos project in Supervisely format Video projects.
- Export Point Clouds Project in Supervisely Format Point cloud projects.
- Export Point Cloud Episodes in Supervisely format Point cloud episodes.
- Export Volumes with 3D Annotations Volumes and masks as NRRD, with NIfTI as an option.
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.
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.
- COCOOne JSON file per dataset with images, annotations and categories: boxes, polygon or RLE segmentation, keypoints.BoxesPolygonsMasksKeypointsCaptions
- YOLOA .txt label file per image with normalized boxes, polygons or keypoints, and a YAML file with the class names.BoxesPolygonsKeypoints
- Pascal VOCAn XML file per image with labeled boxes, PNG masks by class and by object, and ImageSets with the splits.BoxesMasks
- LabelMeA JSON file per image from the LabelMe tool: shapes with a label, a shape type and points in pixels.BoxesPolygonsMasksPolylinesPoints
- CVATThe XML export of the CVAT annotation tool, CVAT for images 1.1: labels of every image or video frame in one file.BoxesPolygonsMasksKeypointsPolylinesPointsTags
- KITTI 3DLiDAR scans as .bin files with camera images, calibration and a text line per 3D box.Cuboids
- nuScenesDriving scenes as JSON tables linked by tokens, with LiDAR, radar and camera data and 3D boxes.CuboidsTags
- DICOM, NRRD & NIfTICT and MRI volumes as DICOM series, NRRD or NIfTI files, with 3D segmentation masks as NRRD or NIfTI.MasksBoxes
- PNG masksSemantic and instance segmentation as PNG images, with a file that maps pixel values to classes.Masks
- CityscapesStreet scenes with a polygon JSON per image, organised by split and city.Polygons