blendersynth.annotations.annotation_handler

blendersynth.annotations.annotation_handler.ANN_TYPES = ['bbox', 'keypoints', 'axes']

Valid annotation types

class blendersynth.annotations.annotation_handler.Annotation(bbox=None, keypoints=None, axes=None)[source]

A class for storing annotations for a single image.

__init__(bbox=None, keypoints=None, axes=None)[source]
Parameters:
  • bbox (List[Union[Vector, ndarray, List, Tuple]]) – Bounding box tuple per instance

  • keypoints (List[ndarray]) – [N x 2] array per instance

  • axes (List[ndarray]) – [4 x 2] array per instance

copy()[source]

Return a deep copy of this Annotation instance

Return type:

Annotation

set(item, value, inplace=False)[source]

Return a new Annotation, with item set to value.

Parameters:
  • item (str) – A key in ANN_TYPES

  • value – Value to set

  • inplace (bool) – If True, set in place and return self

Return type:

Annotation

union(other, priority='other')[source]

Joins two annotations together, returning a new Annotation instance.

Parameters:
  • other (Annotation) – Annotation to join with

  • priority – Which annotation to take priority when merging

Return type:

Annotation

class blendersynth.annotations.annotation_handler.AnnotationHandler(data)[source]

An object for storing and handling per-view Annotation instances

__init__(data)[source]
Parameters:

data (dict) – Dictionary of camera_name: Annotation class

classmethod from_annotations(data, ann_type='bbox')[source]

Create an Annotation Handler from a single type of annotation

Parameters:
  • data (dict) – Dictionary of camera_name: annotation (e.g. bboxes)

  • ann_type (str) – Type of annotation (e.g. ‘bbox’)

Return type:

AnnotationHandler

get_annotation_by_camera(camera_name)[source]

Return annotation for a given camera (default to an empty Annotation instance if not found)

Return type:

Annotation

union(other, priority='other')[source]

Combine two AnnotationHandlers, merging annotations wherever possible. Returns a new instance comprising the union of the two AnnotationHandlers.

Parameters:
  • other (AnnotationHandler) – AnnotationHandler to merge with

  • priority (str) – Which AnnotationHandler to take priority when merging

Return type:

AnnotationHandler