Objects
Supported Shapes
Supervisely Annotation Format supports the following figures:
point
rectangle
polygon
line / polyline
bitmap
alpha_mask
keypoint structures
cuboid
mask_3d
Coordinate System
For two-dimensional mediums (images and videos) we use the following coordinate system (it's similar to a two-dimensional NumPy coordinate system):
All numerical values are provided in pixels.
General Fields
When generating JSON annotation files, we assign each figure a mix of general fields and fields unique for each geometric shape. Some general fields are optional: the system generates them automatically when the data is uploaded/first created. This means that these fields can be omitted during manual annotation.
Optional fields:
Fields definitions:
id
- unique identifier of the current objectclassId
- unique class identifier of the current objectlabelerLogin
- string - the name of user who created the current figurecreatedAt
- string - date and time of figure creationupdatedAt
- string - date and time of the last figure update
Point
Example:
JSON format for this shape:
Fields definitions:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "point"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filepoints
- object with two fields:exterior
- list of 2 values for coordinates (x
andy
in that order) for every figureinterior
- always an empty field for this type of figure
Rectangle
Example:
JSON format for this figure:
Fields definitions:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "rectangle"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filepoints
- object with two fields:exterior
- list of two lists, each containing two coordinates (x
andy
in that order), with the following structure: [[left, top], [right, bottom]]interior
- always an empty list for this type of figure
Polygon (without holes)
Example:
Fields definitions:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "polygon"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filepoints
- object with two fields:exterior
- list of points [point1, point2, point3, etc ...] where each point is a list of two numbers (coordinates) [col, row]interior
- list of elements with the same structure as the "exterior" field. In other words, this is the list of polygons that define object holes. For polygons without holes in them, this field is empty
Polygon (without holes)
Example:
Fields definitions:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "polygon"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filepoints
- object with two fields:exterior
- list of points [point1, point2, point3, etc ...] where each point is a list of two numbers (coordinates) [col, row]interior
- list of elements with the same structure as the "exterior" field. In other words, this is the list of polygons that define object holes.
Polyline
Example:
Fields definitions:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "line"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filepoints
- object with two fields:exterior
- list of points [point1, point2, point3, etc ...] where each point is a list of two numbers (coordinates) [col, row]interior
- always an empty list for this type of figure
Bitmap
Bitmap is a figure that is described by a point of "origin"(upper left corner), which defines the location of the bitmap within the image and a "data" - Boolean matrix encoded into a string, which defines each pixel of the bitmap.
Example:
Fields description:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "bitmap"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filebitmap
- object with two fields:origin
- points (x
andy
coordinates) of the top left corner of the bitmap, i.e. the position of the bitmap within the imagedata
- string - encoded representation of a string
A few words about bitmap
→ data
. You can use these two python methods to convert a base64 encoded string to NumPy and vice versa.
Example:
Program output after executing the code:
Alpha Mask
Alpha Mask is a figure that is described by a point of "origin"(upper left corner), which defines the location of the alpha mask within the image and a "data" - grayscale matrix encoded into a string, which defines each pixel of the alpha mask.
Example:
Fields description:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "alpha_mask"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filebitmap
- object with two fields:origin
- points (x
andy
coordinates) of the top left corner of the alpha mask, i.e. the position of the alpha mask within the imagedata
- string - encoded representation of a string
A few words about bitmap
→ data
. You can use these two Python methods to convert a base64 encoded string to NumPy and vice versa.
Example:
Program output after executing the code:
Keypoint structure
Keypoint structures consist of vertices (also called nodes or points) which are connected by edges (also called links or lines).
Example:
Fields definitions:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "graph"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filenodes
- is a dictionary, where keys denote the names of the graph vertices and values in a dictionary, and where values denote location of a node on imageloc
- list of single points (x
andy
coordinates) of a vertices
Cuboids (2D annotation)
Example:
Fields definitions:
Optional fields
id
,classId
,labelerLogin
,createdAt
,updatedAt
are described abovedescription
- string - text description (optional)geometryType: "cuboid_2d"
- class shapetags
- list of tags assigned to the current objectclassTitle
- string - the title of the current class. It's used to identify the corresponding class shape from themeta.json
filevertices
- is a dictionary, where keys denote the names of the cuboid vertices, and values in a dictionary with a location of a vertex on the image:loc
- list of single points (x
andy
coordinates) of a vertex
Mask3D (3D annotation)
Mask3D is a figure that is described by a 3D array corresponding to the dimensionality of the volume. It is used as an annotation type for volume projects. Geometry data
stores in NRRD files and defines each pixel of the Mask3D. In the previous version whole data
could be stored in JSON annotations as a base64 encoded string.
💡 It's strictly recommended to store whole data
into NRRD files.
👉 To learn how to create Mask3D from NRRD files using our SDK you can read this article.
Below is an example of what the object looks like in the annotation file:
Fields definitions:
key
-objectKey
-geometryType: "mask_3d"
- class shapegeometry
- describes geometry of the object, consist of:mask_3d
- object with one field:data
- string - encoded representation of a string.
shape: "mask_3d"
- geometry namegeometryType": "mask_3d"
geometry type
If the geometry data is stored in NRRD files, mask_3d
→ data
will store an empty array represented as base64 encoded string.
Last updated