Point Cloud Episodes
3D Episodes labeling interface

Project Structure Example

Root folder for the project named project name
  • meta.json file
  • key_id_map.json file
  • Dataset folders, that represents single episode. Each named dataset_name, which contains:
    • annotation.json - file with whole episode annotation
    • frame_pointcloud_map.json - file with pointcloud to episode frame mapping
    • pointcloud folder, contains source point cloud files, for example frame1.pcd, frame2.pcd
    • related_images optional folder, contains photo-context data:
      • Frame folder, each named according to pointcloud (/related_images/frame1/), which contains:
        • image files (.png \ .jpg)
        • image ann files (.json) - json files, named according to image name (1.png -> 1.json)

Main concepts

Point cloud Episode Project Folder
On the top level are stored Project folders, these are the elements visible on the main Supervisely dashboard. Inside them they can contain only Datasets and Poject Meta information, all other data has to be stored a level below in a Dataset (Sequence). All datasets within a project have to contain content of the same cathegory.
Project Meta
Project Meta contains the essential information about the project - Classes and Tags. These are defined project-wide and can be used for labeling in every dataset inside the current project.
Datasets (Sequences)
Datasets are the second level folders inside the project, they host the individual data files (pointclouds), photo context (images) and their annotations.
Items (Point clouds)
Every .pcd file in sequence has to be stored inside a dataset/pointcloud folder. Each file has file name and order number, that defined inside frame_pointcloud_map.json.
The PCD file format description can be found hereโ€‹
Items Annotation
A sequence of frames has a list of objects that are shared between frames. For example, sequence might have 10 cars objects represented by theirs figures in 100 frames.
The list of objects is defined for the entire sequence, even if the object's figure occurs in only one frame.
Figures - represents individual cuboids, attached to one single frame and its object.
1
Example:
2
The sequence contains 3 objects: (car1, car2, pedestrian1) and 10 frames.
3
โ€‹
4
Each frame in the sequence might have a figure for every object.
5
Then it will be 30 figures (10 figures for each object per sequence; 1 figure for the object per frame).
Copied!
Linking between point clouds , Objects and Figures
In Supervisely Annotation Format each point cloud is a frame. Frame contain figures and index: sequence number, that have relation to point cloud name in frame_pointcloud_map.json.
In the example below, created one Car object (with key "6663ca1d20c74bea83bd48c24568989d") for the entire sequence. (Means that this object can appear in any frame of the sequence)
Then, on frames (with indices 0 and 1) figures are placed, and each figure correspond to the Car object by the objectKey field.

Format of annotation.json

1
[
2
{
3
"description": "",
4
"key": "e9f0a3ae21be41d08eec166d454562be",
5
"tags": [],
6
"objects": [
7
{
8
"key": "6663ca1d20c74bea83bd48c24568989d",
9
"classTitle": "car",
10
"tags": []
11
}],
12
"framesCount": 48,
13
"frames": [
14
{
15
"index": 0,
16
"figures": [
17
{
18
"key": "cb8e067dadfc423aa8575a0c4e62de33",
19
"objectKey": "6663ca1d20c74bea83bd48c24568989d",
20
"geometryType": "cuboid_3d",
21
"geometry": {
22
"position": {
23
"x": -10.863547325134277,
24
"y": -93.57706451416016,
25
"z": -4.598618030548096
26
},
27
"rotation": {
28
"x": 0,
29
"y": 0,
30
"z": 3.250733629393711
31
},
32
"dimensions": {
33
"x": 1.978,
34
"y": 4.607,
35
"z": 1.552
36
}
37
}
38
}
39
]
40
},
41
{
42
"index": 1,
43
"figures": [
44
{
45
"key": "71e0fe52dc4f4f6aaf059ad095f43c1f",
46
"objectKey": "6663ca1d20c74bea83bd48c24568989d",
47
"labelerLogin": "username",
48
"updatedAt": "2021-11-11T17:19:11.448Z",
49
"createdAt": "2021-11-11T16:53:03.670Z",
50
"geometryType": "cuboid_3d",
51
"geometry": {
52
"position": {
53
"x": -11.10418701171875,
54
"y": -91.33098602294922,
55
"z": -4.5446248054504395
56
},
57
"rotation": {
58
"x": 0,
59
"y": 0,
60
"z": 3.24780199600921
61
},
62
"dimensions": {
63
"x": 1.978,
64
"y": 4.607,
65
"z": 1.552
66
}
67
}
68
}
69
]
70
}
71
]
72
}
73
]
Copied!
Optional fields and loading These fields are optional and are not needed when loading the project. The server can automatically fill in these fields while project is loading.
  • id - unique identifier of the current object
  • classId - unique class identifier of the current object
  • labelerLogin - string - the name of user who created the current figure
  • createdAt - string - date and time of figure creation
  • updatedAt - string - date and time of the last figure update
Main idea of key fields and id you can see below in Key id map file section.
Fields definitions:
  • description - string - (optional) - this field is used to store the text to assign to the sequence.
  • key - string, unique key for a given sequence (used in key_id_map.json to get the sequence ID)
  • tags - list of strings that will be interpreted as episode tags
  • objects - list of objects that may be present on the episode
  • frames - list of frames of which the episode consists. List contains only frames with an object from the 'objects' field
    • index - integer - number of the current frame
    • figures - list of figures in the current frame.
  • framesCount - integer - total number of frames in the episode
  • geometryType - "cuboid_3d" - class shape
Fields definitions for objects field:
  • key - string - unique key for a given object (used in key_id_map.json)
  • classTitle - string - the title of a class. It's used to identify the class shape from the meta.json file
  • tags - list of strings that will be interpreted as object tags (can be empty)
Fields description for figures field:
  • key - string - unique key for a given figure (used in key_id_map.json)
  • objectKey - string - unique key to link figure to object (used in key_id_map.json)
  • geometryType - "cuboid_3d" -class shape
  • geometry - geometry of the object
Description for geometry field:
  • position 3D vector X, Y, Z values matches the axes on world coordinates, defined in global frame of reference as:
    • +x - forward in the direction of travel ego vehicle
    • +y - left
    • +z - up
  • dimensions is 3D vector with:
    • x - width
    • y - length
    • z - height
  • rotationis 3D Vector with:
    • x - pitch
    • y - roll
    • z - yaw (direction)
Rotation values bound inside [-pi ; pi ] When yaw = 0 box direction will be strict +y

Key id map file

You can avoid using key-id-map directly with API and SDK to create your own file structure. An example will be shown below in the SDK section.
The basic idea behind key-id-map is that it maps the unique identifiers of the object to the frame on which the shape is located. The server works with an identifier, but the file system of the loaded project stores these identifiers and object keys on disk, which is necessary for navigation and use of the high-level API and applications.
When loading a dataset (sequence), the system returns its identifier, after which it is saved to a file on disk, along with the key of the loaded sequence in key-id-map file.
When uploading objects to the server, a sequence ID is required (to determine which sequence the object belongs to), and it can be read from the key-id-map file by key. The system then returns the IDs of the successfully loaded objects.
Then, while figures uploading to the server, an object identifier is required (which loaded object the shape belongs to), which can again be read from the key-id-map file.
While annotating the episode inside Supervisely interface key-id-map file is created automatically, and will be downloaded with entire project. Json format of key_id_map.json:
1
{
2
"tags": {},
3
"objects": {
4
"198f727d40c749eebcacc4aed299b39a": 20520
5
},
6
"figures": {
7
"65f21690780e43b49863c3cbd07eab3a": 503130811
8
},
9
"videos": {
10
"e9f0a3ae21be41d08eec166d454562be": 42656
11
}
12
}
Copied!
  • objects - dictionary, where the key is a unique string, generated inside Supervisely environment to set correspondence of current object in annotation, and values are unique integer ID corresponding to the current object
  • figures - dictionary, where the key is a unique string, generated inside Supervisely environment to set correspondence of object on current frame in annotation, and values are unique integer ID corresponding to the current frame
  • videos - dictionary, where the key is unique string, generated inside Supervisely environment to set correspondence of sequence (dataset) in annotation, and value is a unique integer ID corresponding to the current sequence
  • tags - dictionary, where the keys are unique strings, generated inside Supervisely environment to set correspondence of tag on current frame in annotation, and values are a unique integer ID corresponding to the current tag
  • Key - generated by python3 function uuid.uuid4().hex. The unique string. All key values and id's should be unique inside single project and can not be shared between frames\sequences.
  • Value - returned by server integer identifier while uploading object / figure / sequence / tag

Format of frame_pointcloud_map.json

This file create for mapping between pointcloud files and annotation frames in the correct order.
1
{
2
"0" : "frame1.pcd",
3
"1" : "frame2.pcd",
4
"2" : "frame3.pcd"
5
}
Copied!
Keys - frame order number Values - point cloud name (with extension)

Photo context image annotation file

1
{
2
"name": "host-a005_cam4_1231201437716091006.jpeg"
3
"entityId": 2359620,
4
"meta": {
5
"deviceId": "CAM_BACK_LEFT",
6
"timestamp": "2019-01-11T03:23:57.802Z",
7
"sensorsData": {
8
"extrinsicMatrix": [
9
-0.8448329028461443,
10
-0.5350302199120708,
11
0.00017334762588639086,
12
-0.012363736761232369,
13
-0.0035124448582330757,
14
0.005222293412494302,
15
-0.9999801949951969,
16
-0.16621728572112304,
17
0.5350187183638307,
18
-0.8448167798004226,
19
-0.006291229448121315,
20
-0.3527897896721229
21
],
22
"intrinsicMatrix": [
23
882.42699274,
24
0,
25
602.047851885,
26
0,
27
882.42699274,
28
527.99972239,
29
0,
30
0,
31
1
32
]
33
}
34
}
35
}
Copied!
Fields description:
  • name - string - Name of image file
  • Id - (OPTIONAL) - integer >= 1 ID of the photo in the system. It is not required when upload and is filled in automatically when the project is loaded.
  • entityId (OPTIONAL) - integer >= 1 ID of the Point Cloud in the system, that photo attached to. Doesn't required while uploading.
  • deviceId - string- Device ID or name.
  • timestamp - string - Time when the frame occurred in ISO 8601 format
  • sensorsData - Sensors data such as Pinhole camera model parameters. See wiki: Pinhole camera model and OpenCV docs for 3D reconstruction.
    • intrinsicMatrix - Array of number - 3x3 flatten matrix (dropped last zeros column) of intrinsic parameters in row-major order, also called camera matrix. It's used to denote camera calibration parameters. See Intrinsic parameters.
    • extrinsicMatrix - Array of number - 4x3 flatten matrix (dropped last zeros column) of extrinsic parameters in row-major order, also called joint rotation-translation matrix. It's used to denote the coordinate system transformations from 3D world coordinates to 3D camera coordinates. See Extrinsic_parameters.

SDK

Work with Supervisely projects involves two ways:
  1. 1.
    Labeling within the interface and use of default download / upload applications.
  2. 2.
    Using the API and SDK for manual labeling and data management.
Trying API and SDK is possible in the documented step-by-step example repository.
1
$ git clone https://github.com/supervisely-ecosystem/sdk_pointcloud_episode_example.git
2
$ cd sdk_pointcloud_episode_example
3
$ pip -r requirements.txt
Copied!
This repo stores some test files, the main script main.py and requirements.txt After clone the repository, install the supervise library sdk from the requirements file.
Then, you can run the code, after specifying your token, server address and workspace id.
If you do not have the necessary credentials for connection, please contact technical support via website or slack channel.
Last modified 12d ago