Hasty JSON v1.1
Our own export format that uses a similar structure to COCO, but builds on top of it with added complexity

JSON Example

1
{
2
"project_name": "Project Name",
3
"create_date": "2019-10-22 19:04:16Z",
4
"export_format_version": "1.1",
5
"export_date": "2019-11-19 16:21:18Z",
6
"attributes": [
7
{
8
"name": "ewerwer",
9
"type": "TEXT",
10
"values": ["black", "white"]
11
},
12
{...},
13
],
14
"label_classes": [
15
{
16
"class_name": "cat",
17
"color": "#1f78b44d",
18
"class_type": "object",
19
"attributes": ["black", "white"]
20
},
21
{
22
"class_name": "dog",
23
"color": "#e31a1c4d",
24
"class_type": "object"
25
}
26
],
27
"images": [
28
{
29
"image_name": "IMG_000002.jpg",
30
"dataset_name": "train dataset",
31
"width": 500,
32
"height": 430,
33
"image_status": "TO REVIEW",
34
"labels": [
35
{
36
"class_name": "cat",
37
"bbox": [102, 45, 420, 404],
38
"polygon": null,
39
"mask": null,
40
"z_index": 1,
41
"attributes":{"attribute_name":"xyz"}
42
},
43
{...},
44
{...}
45
],
46
"tags":["xyz","pqr"]
47
},
48
{...},
49
{...}
50
]
51
}
Copied!

The Project object

Attributes

project_name string The name of the project
create_date string The project creation date in format YYYY-MM-DD HH:MI:SSZ
export_format_version string Internal file format version
export_date string The project export date in format YYYY-MM-DD HH:MI:SSZ
label_classes list of Label Class objects Projects label classes
attributes list of attribute objects
images list of Image objects The list of images and associated labels

The Label Class object

Attributes

class_name string The name of the class
color string Associated with the label class color, in format #RRGGBBAA
class_type string Class type, "object" or "background"
attributes list of strings attributes of the label class

The Image object

Attributes

image_name string The image filename
dataset_name string Dataset name
width integer Image width in pixels
height integer Image height in pixels
image_status string Image status. Possible values:
  • NEW
  • IN PROGRESS
  • TO REVIEW
  • SKIPPED
  • DONE
labels list of label object The list of labels associated with the image
tags list list of strings

The Label object

Attributes

class_name string The name of the class
bbox list of integers or null Bounding box label. 4 numbers defining xmin, xmax, ymin, and ymax
polygon list of the list of integers or null Polygon coordinates, list of polygon vertices (x0, y0), (x1, y1), ...
mask list of integers or null RLE Encoded mask
z_index integer The z-index property specifies the stack order of an element. An element with a greater stack order is always in front of an element with a lower stack order.
attributes dictionary Attribute object

The Attribute object

Attributes
name string The name of the attribute
type string Possible values:
  • SELECTION
  • MULTIPLE-SELECTION
  • TEXT
  • INT
  • FLOAT
  • BOOL
value list The list of the values of attributes

RLE Encoding python example

1
import numpy as np
2
3
4
def rle_decode(mask_rle, shape):
5
"""
6
mask_rle: run-length as string formatted (start length)
7
shape: (width, height) of array to return
8
Returns numpy array, 1 - mask, 0 - background
9
"""
10
s = mask_rle
11
starts, lengths = [np.asarray(x, dtype=int) for x in (s[0:][::2], s[1:][::2])]
12
starts -= 1
13
ends = starts + lengths
14
shape = shape[1], shape[0]
15
img = np.zeros(shape[0] * shape[1], dtype=np.uint8)
16
for lo, hi in zip(starts, ends):
17
img[lo:hi] = 1
18
return img.reshape(shape)
19
20
21
bbox = [24, 307, 43, 320]
22
mask_rle = [11, 2, 26, 2, 30, 2, 45, 3, 49, 3, 60, 2, 65, 7, 79, 4, 84, 7, 99, 12, 115, 1, 119, 8, 128, 3, 134, 10, 149, 2, 154, 9, 164, 3, 169, 2, 173, 9, 189, 2, 193, 8, 206, 3, 214, 13, 234, 10]
23
24
mask = rle_decode(mask_rle, (bbox[2]-bbox[0], bbox[3]-bbox[1]))
Copied!
Can’t find what you are looking for in our documentation? Get in contact with me, Herbert Janssen, community manager here at Hasty by emailing [email protected] if you have any questions or need help.
Last modified 4mo ago