MeshLabel

class MeshLabel(geometry, obj_class, tags=None, description='', key=None, sly_id=None, class_id=None, labeler_login=None, updated_at=None, created_at=None, custom_data=None, priority=None, status=None)[source]

Bases: object

Single geometry-backed label in a mesh annotation.

Initialize a single geometry-backed annotation object.

Parameters:
geometry

Geometry of the label.

obj_class

Object class the label belongs to.

tags=None

Tags attached to the label.

description : Optional[str]

Free-text description of the label.

key : Optional[uuid.UUID]

Unique identifier of the label. Generated automatically if not provided.

sly_id : Optional[int]

Label ID in Supervisely.

class_id : Optional[int]

Object class ID in Supervisely.

labeler_login : Optional[str]

Login of the user who created the label.

updated_at : Optional[str]

Timestamp of the last update.

created_at : Optional[str]

Timestamp of creation.

custom_data : Optional[dict]

Arbitrary user data attached to the label.

priority : Optional[int]

Drawing/processing priority of the label.

status=None

Labeling status (defaults to LabelingStatus.MANUAL).

Raises:

TypeError – If the geometry type does not match the object class geometry type.

Methods

clone

Return a copy of the label with the given fields overridden.

from_json

Deserialize a mesh label from a JSON dict.

key

Return the unique identifier of the label.

to_json

Serialize the label to a JSON-serializable dict.

Attributes

class_id

Object class ID in Supervisely.

custom_data

Arbitrary user data attached to the label (returned as a deep copy).

description

Free-text description of the label.

geometry

Geometry of the label.

obj_class

Object class the label belongs to.

priority

Drawing/processing priority of the label.

sly_id

Label ID in Supervisely.

status

Labeling status of the label.

tags

Tags attached to the label (returned as a copy).

classmethod from_json(data, project_meta)[source]

Deserialize a mesh label from a JSON dict.

Parameters:
data : dict

Mesh label in JSON format.

project_meta

Project meta used to resolve the object class and tag metas.

Returns:

Deserialized mesh label.

Return type:

MeshLabel

Raises:

RuntimeError – If the object class is missing from the project meta or geometry is absent.

clone(geometry=None, obj_class=None, tags=None, description=None, key=None, sly_id=None, class_id=None, labeler_login=None, updated_at=None, created_at=None, custom_data=None, priority=None, status=None)[source]

Return a copy of the label with the given fields overridden.

Any argument left as None keeps the current value of the label.

Parameters:
geometry=None

New geometry.

obj_class=None

New object class.

tags=None

New tags.

description : Optional[str]

New description.

key : Optional[uuid.UUID]

New unique identifier.

sly_id : Optional[int]

New label ID in Supervisely.

class_id : Optional[int]

New object class ID in Supervisely.

labeler_login : Optional[str]

New labeler login.

updated_at : Optional[str]

New update timestamp.

created_at : Optional[str]

New creation timestamp.

custom_data : Optional[dict]

New custom data.

priority : Optional[int]

New priority.

status=None

New labeling status.

Returns:

New mesh label with the overridden fields.

Return type:

MeshLabel

key()[source]

Return the unique identifier of the label.

Returns:

Label key.

Return type:

uuid.UUID

to_json()[source]

Serialize the label to a JSON-serializable dict.

Returns:

Dict with key, object class name, description, tags, geometry and metadata.

Return type:

dict

property class_id : int | None

Object class ID in Supervisely.

Return type:

Optional[int]

property custom_data : dict

Arbitrary user data attached to the label (returned as a deep copy).

Return type:

dict

property description : str

Free-text description of the label.

Return type:

str

property geometry : supervisely.geometry.geometry.Geometry

Geometry of the label.

Return type:

Geometry

property obj_class : supervisely.annotation.obj_class.ObjClass

Object class the label belongs to.

Return type:

ObjClass

property priority : int | None

Drawing/processing priority of the label.

Return type:

Optional[int]

property sly_id : int | None

Label ID in Supervisely.

Return type:

Optional[int]

property status : supervisely.annotation.label.LabelingStatus

Labeling status of the label.

Return type:

LabelingStatus

property tags : supervisely.mesh_annotation.mesh_tag_collection.MeshTagCollection

Tags attached to the label (returned as a copy).

Return type:

MeshTagCollection