Format Reference
Reference types that are common across the SDK are documented on this page.

RedBrick AI Export Format

1
[
2
{
3
"name": "image_name", // same unique name used on upload
4
"items": ["image/url.png"], // image url, or frame urls
5
"itemsPresigned": ["image/url_presigned.png"], // same as above, but signed urls
6
"createdBy": "[email protected]",
7
"taskId": "123", // unique id assigned to each task
8
9
"labels": [LabelObject]
10
},
11
]
Copied!

LabelObject

Useful for understanding the RedBrick label format used for exports and label imports.
1
// LabelObject
2
{
3
"category": [["object", str]], // String must belong to Project Taxonomy
4
"attributes": [LabelAttribute],
5
"labelid": str, // Uniqye for every label
6
7
"bbox2d": null or {BBox2d},
8
"polygon": null or [Point],
9
"polyline": null or [Point],
10
"point": null or Point,
11
"ellipse": null or {Ellipse},
12
"pixel": null or {Pixel},
13
14
// only included if you have classification labels
15
"frameclassify": null or bool,
16
"taskclassify": null or bool,
17
18
// only inlcluded for video projects
19
"frameindex": null or int,
20
"trackid": null or str, // unique id for an object track across frames
21
"keyframe": null or bool, // True if manually labeled, False if interpolated
22
"end": null or bool // True if this label is the last label of a track.
23
}
24
25
// LabelAttribute
26
{
27
"name": str,
28
"value": any
29
}
30
31
// BBox2d
32
{
33
"xnorm": float, // [0, 1]
34
"ynorm": float,
35
"wnorm": float,
36
"hnorm": float
37
}
38
39
// Point
40
{
41
"xnorm": float,
42
"ynorm": float
43
}
44
45
// Ellipse
46
{
47
"xcenternorm": float,
48
"ycenternorm": float,
49
"xnorm": float,
50
"ynorm": float,
51
"rot": float, // [0, pi) radians
52
}
53
54
// Pixel
55
{
56
"imagesize": [int, int], // width, height in pixels,
57
"regions": [[[int, int]]],
58
"holes": null or [[[int, int]]]
59
}
60
Copied!
All xnorm values are x co-ordinates normalized by the width of the image.
All ynorm values are y co-ordinates normalized by the height of the image.
The LabelObject requires at least one of the label type fields - bbox2d, polygon, polyline, point, ellipse, pixel, taskclassify: true entries. The entries must match the label type of your Project.

Taxonomy Objects

1
// TaxonomyObject
2
{
3
"name": str,
4
"version": int,
5
"categories": [CategoryObject],
6
"attributes": [AttributeObject]
7
}
8
9
// CategoryObject
10
{
11
"name": str, // must be a part of the Project Taxonomy
12
"classId": int, // [0, n) where n is number of categories
13
"children": [CategoryObject]
14
}
15
16
// AttributeObject
17
{
18
"name": str,
19
"attrType": str
20
}
Copied!

Task Objects

1
// TaskObject
2
{
3
"taskId": str, // unique id
4
"labels": [LabelObject],
5
"items": [str], // Unsigned URL's
6
"itemsPresigned": [str], // Signed URL's to download images
7
"name": str // unique name given when creating a datapoint
8
}
Copied!

PNG Mask Formats

For exporting to masks, or importing masks to RedBrick AI projects, you have to follow the formats outlined in this section. The masks directory will have the following structure:
1
# On Export, the directory will be named after your project_id
2
# On Upload, you can name the directory whatever you like.
3
4
project_id
5
├── uuid_1.png # On Export, masks file name will be the unique task_id.
6
├── uuid_2.png # On Upload, mask file name will be used as the datapoint name.
7
├── uuid_3.png
8
├── datapoint_map.json # Map from mask filename -> image items path
9
└── class_map.json # Map from object category -> mask color
Copied!
PNG Masks
The masks will be RGB PNG's with 8 bit integer pixel values [0, 255] (the corresponding class can be found the class_map.json).
Class Map
The mask PNG's are 3 channel RGB images. The mapping from RGB values to category names is provided in the class_map.json.
1
// class_map.json
2
{
3
"category_1": [1, 10, 2] // rgb values [0, 255]
4
"category_2": [29, 198, 22]
5
.
6
.
7
}
Copied!
Datapoint Map
The datapoint_map.json file contains a mapping between the mask filename and the corresponding image file path. The datapoint_map.json will be the following format:
  • Keys
    • Name of your PNG masks, which will be the unique task_id field.
  • Values
    • The items field that was used on upload. If Direct Upload was used, this will be a string with your original filename at the end of the string for e.g. uuid/images/uuid/your_file_name.png.
1
// datapoint_map.json
2
{
3
"mask_file_name_1.png": "https://path_to_my_image_1.png",
4
"mask_file_name_2.png": "https://path_to_my_image_2.png",
5
.
6
.
7
}
Copied!
Last modified 7d ago