Skip to main content

Annotation

class dataframe.Annotation(values=None, id=None, labels=None, confidence=None, metadata=None)

Annotation object, representing general purpose annotation data. Should be inherited and extended/specified as needed

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values (Union[Sequence[Union[int, float]], Sequence[Sequence[Union[int, float]]], None]) – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional[str]) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional[Sequence[str]]) – List of labels (string)

    • confidence (Optional[float]) – confidence of annotation

    • metadata (Optional[dict]) – General purpose dictionary storing multiple field/values

  • Return type

    None


label_enum

property label_enum

Returns the enumeration value (integer) based on the DataView mapping, this is a readonly field

  • Return type

    Optional[int]

  • Returns

    (int)


Annotation.get_type

classmethod get_type()

  • Return type

    str

  • Returns

    Unique string representing the annotation type. Optional values: “p2d”, “k2d”, “k3d”, “elp”, “b2d”, “b3d”, “im”, “mask”


values

property values

  • Return type

    Union[Sequence[Union[int, float]], Sequence[Sequence[Union[int, float]]], None]

  • Returns

    list(float), or list(list(float)), values associated with the annotation object


id

property id

Returns an ID (str) associated with the annotation object, None if not applicable.

  • Return type

    Optional[str]

  • Returns

    Unique ID for the annotation in within a frame context


labels

property labels

Returns a list of labels (strings) associated with the annotation object

  • Return type

    Optional[Sequence[str]]

  • Returns

    list(str)


metadata

property metadata

Returns General purpose dictionary storing multiple field/values

  • Return type

    Optional[dict]

  • Returns

    (dict)


confidence

property confidence

Returns confidence level associated with the annotation

  • Return type

    Optional[float]

  • Returns

    (float)


to_dict

to_dict()

Return REST API compliant dictionary

  • Return type

    dict

  • Returns

    API compliant dictionary for use directly with REST-API


register

static register(*type_names)

A decorator to register an annotation type name for classes deriving from Annotation

  • Parameters

    type_names (list ( str ) ) – List of annotation types to associated with the class type.

  • Return type

    Callable


copy

copy()

Returns a copy of this Annotation. :param id: An optional ID value. if None, a new random UUID will be created.

  • Return type

    Annotation

  • Returns

    Annotation object

class dataframe.Mask(mask_rgb=None, id=None, labels=None, confidence=None, metadata=None, mask_id=None)

Extending Annotation class object.

Mask object, representing a mask annotation.

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • mask_rgb (Optional [ Sequence [ int , int , int ] ] ) –

    • mask_id (Optional [ str ] ) –

  • Return type

    ()


mask_id

property mask_id

  • Return type

    str

  • Returns

    mask ID


mask_rgb

property mask_rgb

  • Return type

    Sequence[int, int, int]

  • Returns

    list of RGB [int, int, int]

class dataframe.Polygon2D(polygon_xy=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

Polygon2D object, representing a 2D polygon, parsing the set of float values as pairs of x,y vertices.

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • polygon_xy (Optional [ Sequence [ Tuple [ float , float ] ] ] ) –

  • Return type

    ()


get_bounding_box

get_bounding_box()

Get the bounding box for this 2D polygon

  • Return type

    Sequence[4, float]

  • Returns

    [left_x top_y width height]


polygon_xy

property polygon_xy

  • Return type

    Sequence[Tuple[float, float]]

  • Returns

    list of x,y pairs [(float, float), ]

class dataframe.ComplexPolygon2D(polygons_xy=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

ComplexPolygon2D object, representing a set of 2D polygons, parsing the set of float values as list of polygons (with pairs of x,y vertices per polygon).

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • polygons_xy (Optional [ Sequence [ Sequence [ Tuple [ float , float ] ] ] ] ) –

  • Return type

    ()


get_bounding_box

get_bounding_box()

Get the bounding box for this 2D polygon

  • Return type

    Sequence[4, float]

  • Returns

    [left_x top_y width height]


polygons_xy

property polygons_xy

  • Return type

    Sequence[Sequence[Tuple[float, float]]]

  • Returns

    list of list of x,y pairs [[(float, float), ], [(float, float), ], ]

class dataframe.Polygon3D(polygon_xyz=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

Polygon3D object, representing a 3D polygon, parsing the set of float values as triplets of x,y,z vertices.

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • polygon_xyz (Optional [ Sequence [ Tuple [ float , float , float ] ] ] ) –

  • Return type

    ()


polygon_xyz

property polygon_xyz

  • Return type

    Sequence[Tuple[float, float, float]]

  • Returns

    list of x,y,z triplets [(float, float, float), ]

class dataframe.ComplexPolygon3D(polygons_xyz=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

ComplexPolygon3D object, representing a set of 3D polygons, parsing the set of float values as list of polygons (with triplets of x,y,z vertices per polygon).

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional[str]) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional[Sequence[str]]) – List of labels (string)

    • confidence (Optional[float]) – confidence of annotation

    • metadata (Optional[dict]) – General purpose dictionary storing multiple field/values

    • polygons_xyz (Optional [ Sequence [ Sequence [ Tuple [ float , float , float ] ] ] ] ) –

  • Return type

    None


polygons_xyz

property polygons_xyz

  • Return type

    Sequence[Sequence[Tuple[float, float, float]]]

  • Returns

    list of list of x,y,z triplets [[(float, float, float), ], [(float, float, float), ], ]

class dataframe.KeyPoints2D(keypoints_xy=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

KeyPoints2D object, representing a 2D set of key points, parsing the set of float values as pairs of x,y points.

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • keypoints_xy (Optional [ Sequence [ Tuple [ float , float ] ] ] ) –

  • Return type

    ()


get_bounding_box

get_bounding_box()

Get the bounding box for this 2D key points object

  • Return type

    Sequence[4, float]

  • Returns

    [left_x top_y width height]


keypoints_xy

property keypoints_xy

  • Return type

    Sequence[Tuple[float, float]]

  • Returns

    list of x,y pairs [(float, float), ]

class dataframe.KeyPoints3D(keypoints_xyz=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

KeyPoints3D object, representing a 3D set of key points, parsing the set of float values as triplets of x,y,z points.

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • keypoints_xyz (Optional [ Sequence [ Tuple [ float , float , float ] ] ] ) –

  • Return type

    ()


keypoints_xyz

property keypoints_xyz

  • Return type

    Sequence[Tuple[float, float, float]]

  • Returns

    list of x,y,z triplets [(float, float, float), ]

class dataframe.Ellipse2D(ellipse2d_xyrrt=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

Ellipse2D object, representing an 2D Ellipse, parsing the central point with rx and ry as radii and theta as the rotation angle (radians)

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • ellipse2d_xyrrt (Optional [ Sequence [ 5 , float ] ] ) –

  • Return type

    ()


angle

property angle

Return the angle (radians) of the ellipse

  • Return type

    float

  • Returns

    float represent the angle (radians)


center

property center

Return the center of the ellipse

  • Return type

    Tuple[float, float]

  • Returns

    (float, float) represent the center x, y coordinates


ellipse2d_xyrrt

property ellipse2d_xyrrt

  • Return type

    Sequence[float, float, float, float, float]

  • Returns

    list of x, y, rx, ry and theta as angle (radians) [float, float, float, float, float]


get_bounding_box

get_bounding_box()

Get the bounding box for this 2D ellipse (angle in radians)

  • Return type

    Sequence[5, float]

  • Returns

    [left_x top_y width height angle]


get_polygon

get_polygon(num_point=4)

Get a polygon points wrapping the ellipse

  • Parameters

    num_point (int) – the number of polygon points.

  • Return type

    Sequence[Tuple[float, float]]

  • Returns

    list of x,y pairs [(float, float), (float, float), …]


radii

property radii

Return the radii of the ellipse

  • Return type

    Tuple[float, float]

  • Returns

    (float, float) represent the (rx, ry)

class dataframe.BoundingBox2D(bounding_box_xywh=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

BoundingBox2D object, representing a 2D bounding-box, parsing the set of float values as 5 values as top, left, width, height, angle (radians) values.

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • bounding_box_xywh (Optional [ Sequence [ 5 , float ] ] ) –

  • Return type

    ()


angle

property angle

  • Return type

    float

  • Returns

    angle (radians) of the bounding box


bounding_box_xywh

property bounding_box_xywh

  • Return type

    Sequence[4, float]

  • Returns

    list of top x,left y, width, height of the bounding box (float, float, float, float)


bounding_box_xywha

property bounding_box_xywha

  • Return type

    Sequence[5, float]

  • Returns

    list of top x,left y, width, height, angle (radians) of the bounding box (float, float, float, float, float)


get_bounding_box

get_bounding_box()

Get the bounding box for this 2D bounding box (angle in radians)

  • Return type

    Sequence[4, float]

  • Returns

    [left_x top_y width height]

class dataframe.BoundingBox3D(bounding_box_3d_xyzwhxyzwh=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

BoundingBox3D object, representing a 3D bounding-box, parsing the set of float values as: front-top-left corner (triplets x,y,z), front-width, front-height, back-top-left corner (triplets x,y,z), back-width, back-height

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • bounding_box_3d_xyzwhxyzwh (Optional [ Sequence [ 10 , float ] ] ) –

  • Return type

    ()


bounding_box_3d_xyzwhxyzwh

property bounding_box_3d_xyzwhxyzwh

  • Return type

    Sequence[10, float]

  • Returns

    list of 10 floats: front-top-left corner (triplets x,y,z), front-width, front-height, back-top-left corner (triplets x,y,z), back-width, back-height

class dataframe.ImageAnnotation(image_classes=None, id=None, labels=None, confidence=None, metadata=None)

Extending Annotation class object.

ImageAnnotation annotation object, representing an image level annotation (applies for the entire image)

Create a new annotation object .. note:: In case you need to annotate the same object with more than one annotation type, associate the annotation objects by giving them the same id.

  • Parameters

    • values – A sequence of numeric values or a list of sequences of numeric values

    • id (Optional [ str ] ) – String representing the specific annotation. Useful for tracking objects. None is a valid option.

    • labels (Optional [ Sequence [ str ] ] ) – List of labels (string)

    • confidence (Optional [ float ] ) – confidence of annotation

    • metadata (Optional [ dict ] ) – General purpose dictionary storing multiple field/values

    • image_classes (Optional [ Sequence [ str ] ] ) –

  • Return type

    ()