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

json
      {
  "project_name": "Project Name",
  "create_date": "2019-10-22 19:04:16Z",
  "export_format_version": "1.1",
  "export_date": "2019-11-19 16:21:18Z",
  "attributes": [
    {
      "name": "ewerwer",
      "type": "TEXT",
      "values": ["black", "white"]
    },
    {...},
    ],
  "label_classes": [
    {
      "class_name": "cat",
      "color": "#1f78b44d",
      "class_type": "object",
      "attributes": ["black", "white"]
    },
    {
      "class_name": "dog",
      "color": "#e31a1c4d",
      "class_type": "object"
    }
  ],
  "images": [
    {
      "image_name": "IMG_000002.jpg",
      "dataset_name": "train dataset",
      "width": 500,
      "height": 430,
      "image_status": "TO REVIEW",
      "labels": [
        {
          "class_name": "cat",
          "bbox": [102, 45, 420, 404],
          "polygon": null,
          "mask": null,
          "z_index": 1,
          "attributes":{"attribute_name":"xyz"}
        },
        {...},
        {...}
      ],
      "tags":["xyz","pqr"]
    },
    {...},
    {...}
  ]
}
    

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

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

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 o_f label object\
The list of labels associated with the image

tags list\
list of strings

class_name string\
The name of the class

bbox list of integers or null\
Bounding box label. 4 numbers. [X_top_left, Y_top_left, X_bottom_right, Y_bottom_right].

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

Please note that Hasty JSON v1.1 Run-Length Encoded masks should be related to the bounding box, not the entire image. Check out the RLE Decoding Python Example section for a quick code example.

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

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

python
      python
import numpy as np


def rle_decode(mask_rle, shape):
    """
    mask_rle: run-length as string formatted (start length)
    shape: (width, height) of array to return
    Returns numpy array, 1 - mask, 0 - background
    """
    s = mask_rle
    starts, lengths = [np.asarray(x, dtype=int) for x in (s[0:][::2], s[1:][::2])]
    starts -= 1
    ends = starts + lengths
    shape = shape[1], shape[0]
    img = np.zeros(shape[0] * shape[1], dtype=np.uint8)
    for lo, hi in zip(starts, ends):
        img[lo:hi] = 1
    return img.reshape(shape)


bbox = [24, 307, 43, 320]
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]

mask = rle_decode(mask_rle, (bbox[2]-bbox[0], bbox[3]-bbox[1]))
    

Boost model performance quickly with AI-powered labeling and 100% QA.

Learn more
Last modified