Documentation
Search…
Label types
When downloading or uploading labels using the Python SDK, the format of theattributes field depends on the type of label. The different formats are described here.

Image

Segmentation labels

Format of the attributes field in client.get_label():
1
{
2
"format_version": "0.1",
3
"annotations": [
4
{
5
"id": 1, // this is an object id
6
"category_id": 1 // this is a category id
7
},
8
{
9
"id": 2,
10
"category_id": 1
11
},
12
{
13
"id": 3,
14
"category_id": 4
15
}
16
],
17
"segmentation_bitmap": {
18
"url": "https://segmentsai-staging.s3.eu-west-2.amazonaws.com/assets/davy/ddf55e99-1a6f-42d2-83e9-8657de3259a1.png"
19
}
20
}
Copied!
Thesegmentation_bitmapurl refers to a 32-bit RGBA png image which contains the segmentation masks. The alpha channel is set to 255, and the remaining 24-bit values in the RGB channels correspond to the object ids in the annotations list. Because of the large dynamic range, these png images may appear black in an image viewer.
Use the utils.load_label_bitmap_from_url(url) function in the Python SDK to load the label bitmap as a numpy array containing object ids.

Vector labels (bounding box, polygon, polyline, keypoint)

Format of the attributes field in client.get_label():
1
{
2
"format_version": "0.1",
3
"annotations": [
4
{
5
"id": 1, // the object id
6
"category_id": 1, // the category id
7
"type": "bbox", // refers to the annotation type (bounding box)
8
"points": [
9
[12.34, 56.78], // x0, y0 (upper left corner of bbox)
10
[90.12, 34.56] // x1, y1 (lower right corner of bbox)
11
]
12
},
13
{
14
"id": 2,
15
"category_id": 2,
16
"type": "polygon", // refers to the annotation type (polygon)
17
"points": [
18
[12.34, 56.78], // x0, y0 (starting point of the polygon)
19
[90.12, 34.56], // x1, y1
20
[78.91, 23.45], // x2, y2
21
[67.89, 98.76], // x3, y3
22
[54.32, 10.01] // x4, y4
23
]
24
},
25
{
26
"id": 3,
27
"category_id": 3,
28
"type": "polyline", // refers to the annotation type (polyline)
29
"points": [
30
[12.34, 56.78], // x0, y0 (starting point of the polyline)
31
[90.12, 34.56], // x1, y1
32
[78.91, 23.45], // x2, y2
33
[67.89, 98.76], // x3, y3
34
[54.32, 10.01] // x4, y4
35
]
36
},
37
{
38
"id": 4,
39
"category_id": 4,
40
"type": "point", // refers to the annotation type (keypoint)
41
"points": [
42
[12.34, 56.78] // x, y (coordinates of keypoint)
43
]
44
},
45
],
46
}
Copied!

Image sequence

Segmentation labels

Coming soon.

Vector labels (bounding box, polygon, polyline, keypoint)

Coming soon.

3D point cloud

Segmentation labels

Format of the attributes field in client.get_label():
1
{
2
"format_version": "0.1",
3
"annotations": [
4
{
5
"id": 1, // the object id
6
"category_id": 1 // the category id
7
},
8
{
9
"id": 2,
10
"category_id": 1
11
},
12
{
13
"id": 3,
14
"category_id": 4
15
}
16
],
17
"point_annotations": [0, 0, 0, 3, 2, 2, 2, 1, 3...], // refers to object ids
18
}
Copied!

Cuboid labels

Format of the attributes field in client.get_label():
1
{
2
"format_version": "0.1",
3
"annotations": [
4
{
5
"id": 1, // the object id
6
"category_id": 1, // the category id
7
"type": "cuboid", // refers to the annotation type (cuboid)
8
"position": {
9
"x": 0.0,
10
"y": 0.2,
11
"z": 0.5
12
},
13
"dimensions": {
14
"x": 1.2,
15
"y": 1,
16
"z": 1
17
},
18
"yaw": 1.63
19
}
20
]
21
}
Copied!

3D point cloud sequence

Segmentation labels

Format of the attributes field in client.get_label():
1
{
2
"format_version": "0.1",
3
"frames": [
4
{ ... },
5
{ ... },
6
{ ... }
7
]
8
}
Copied!
Where each frames object has the following format:
1
{
2
"format_version": "0.1",
3
"annotations": [
4
{
5
"id": 1, // the object id
6
"category_id": 1, // the category id
7
"attributes": {
8
"track_id": 3 // this id is used to link objects across frames
9
}
10
},
11
{
12
"id": 2,
13
"category_id": 1,
14
"attributes": {
15
"track_id": 4
16
}
17
},
18
{
19
"id": 3,
20
"category_id": 4,
21
"attributes": {
22
"track_id": 5
23
}
24
},
25
],
26
"point_annotations": [0, 0, 0, 3, 2, 2, 2, 1, 3...], // refers to object ids
27
}
Copied!

Cuboid labels

Format of the attributes field in client.get_label():
1
{
2
"format_version": "0.1",
3
"frames": [
4
{ ... },
5
{ ... },
6
{ ... }
7
]
8
}
Copied!
Where each frames object has the following format:
1
{
2
"annotations": [
3
{
4
"id": 1, // the object id
5
"category_id": 1, // the category id
6
"type": "cuboid", // refers to the annotation type (cuboid)
7
"position": {
8
"x": 0.0,
9
"y": 0.2,
10
"z": 0.5
11
},
12
"dimensions": {
13
"x": 1.2,
14
"y": 1,
15
"z": 1
16
},
17
"yaw": 1.63,
18
"isKeyframe": true, // whether this frame is a keyframe
19
"attributes": {
20
"track_id": 6 // this id is used to links objects across frames
21
}
22
},
23
{
24
"id": 2,
25
"category_id": 2,
26
"type": "cuboid",
27
"position": {
28
"x": 0.0,
29
"y": 0.2,
30
"z": 0.5
31
},
32
"dimensions": {
33
"x": 1.2,
34
"y": 1,
35
"z": 1
36
},
37
"yaw": 1.63,
38
"isKeyframe": false,
39
"attributes": {
40
"track_id": 7
41
}
42
}
43
]
44
},
Copied!

Object attributes

Objects in the annotations list can optionally also contain an attributes field to store object-level attributes. Make sure to properly configure the label editor if you're using object-level attributes.
1
{
2
"format_version": "0.1",
3
"annotations": [
4
{
5
"id": 1,
6
"category_id": 1,
7
"attributes": { // object-level attributes
8
"is_crowd": "1",
9
"color": "red"
10
}
11
},
12
{
13
"id": 2,
14
"category_id": 1,
15
"attributes": {
16
"is_crowd": "0",
17
"color": "blue"
18
}
19
},
20
{
21
"id": 3,
22
"category_id": 4,
23
"attributes": {
24
"is_crowd": "1",
25
"color": "yellow"
26
}
27
}
28
],
29
...
30
}
Copied!

Image attributes

You can also define image-level attributes. These can be useful in image classification tasks. Make sure to properly configure the label editor if you're using image-level attributes.
1
{
2
"format_version": "0.1",
3
"annotations": [...],
4
"image_attributes": { // sample-level attributes
5
"scene_type": "crossroads",
6
"weather": "sunny"
7
}
8
}
Copied!
Last modified 8d ago