AnnotationEntity

class scenebox.models.annotation.AnnotationEntity(label, annotation_type, class_name=None, coordinates=None, confidence=None, mask_color=None, mask_id=None, uid=None, category_id=None, related_annotations=None, attributes=None, mask_type=None, keypoints=None, connections=None)

Initialize a singular annotation entity (an annotation component such as a singular bounding box, polygon, etc.)

Several annotation entities can be saved into the attributes of a single Annotation instance (either manually using the Annotation class, or automatically using any class that inherits Annotation such as BoundingBoxAnnotation/PolygonAnnotation/etc.). These entities appear on SceneBox under one provider/model as a union of all passed annotation entities.

Parameters:
  • label – Name of the point/region that the annotation highlights.

  • annotation_type – Annotation type (bounding box, polygon, etc.). Choose from scenebox.constants.AnnotationTypes.VALID_TYPES.

  • class_name – Name of the class that the label belongs to.

  • coordinates – An ordered list of each coordinate inside the annotation (if creating bounding box, polygon, line, etc.). Each coordinate must be provided in the form (x, y) for two-d annotations and (x, y, z) for three-d annotations. Connections are assumed between consecutive coordinates. For cuboid annotations, coordinate values are assumed to be world-normalized and can be negative. For point, line, polygon and bounding-box annotations, the coordinates need to be positive.

  • confidence – Labelling confidence. Must be between 0 and 1.

  • mask_color – If creating a mask/segmentation, represents the color of the mask region to be extracted in the mask source image.

  • mask_id – If creating a mask/segmentation, represents the annotation ID to give to the mask

  • uid – The globally unique ID to give to the annotation entity

  • category_id – Label category ID.

  • related_annotations – Any related annotations to the annotation.

  • attributes – Optional auxiliary annotation entity attributes.

  • mask_type – Denotes the mask image color scheme. There are two accepted mask color schemes: “MultiColor”, or “SingleColor”. A “MultiColor” mask image may contain several colors (and must include its respective mask_colors color). A “SingleColor” mask is transparent and white (White denotes mask region). All list entries must be “Multicolor” or “SingleColor”.

  • keypoints – If creating a Pose annotation, represents all Points contained in the pose.

  • connections – Defines the directed connections between the Points (coordinates) specified in keypoints.

Methods

to_dic

return a dictionary object representative of Annotation entity :return: dictionary object

to_dic()

return a dictionary object representative of Annotation entity :return: dictionary object