crowsetta.interface.bbox.BBoxLike#
- class crowsetta.interface.bbox.BBoxLike[source]#
Bases:
BaseFormat,ABCAn abstract base class defining the interface for any annotation format that can be represented as a set of labeled bounding boxes.
In terms of code in
crowsetta, a bounding box-like format is any format that can be represented as a collection ofcrowsetta.BBoxinstances. The code block below shows some of the features of this data type.>>> from crowsetta import BBox >>> a_bbox = BBox( ... label='a', ... onset=1.0, ... offset=2.0, ... low_freq=5000, ... high_freq=10000, ... ) >>> another_bbox = BBox( ... label='a', ... onset=3.0, ... offset=4.0, ... low_freq=5000, ... high_freq=10000, ... ) >>> list_of_bboxes = [a_bbox, another_bbox] >>> for bbox in list_of_bboxes: print(segment) BBox(onset=1.0, offset=2.0, low_freq=5000, high_freq=10000, label='a') BBox(onset=3.0, offset=4.0, low_freq=5000, high_freq=10000, label='a') >>> a_bbox.onset 1.0
- __init__()#
Methods
__init__()Loads an annotation from a file in a given format.
to_annot()Converts the instance representing annotations loaded from a file into a
crowsetta.Annotationor alistofAnnotationinstances, that can be used to convert to other formats.to_bbox()Converts the annotation to a
crowsetta.BBoxinstance or a PythonSequenceofcrowsetta.BBoxinstances.- abstractmethod classmethod from_file() Self#
Loads an annotation from a file in a given format.
- abstractmethod to_annot() crowsetta.Annotation | List[crowsetta.Annotation]#
Converts the instance representing annotations loaded from a file into a
crowsetta.Annotationor alistofAnnotationinstances, that can be used to convert to other formats.
- to_bbox() crowsetta.BBox | Sequence[crowsetta.BBox][source]#
Converts the annotation to a
crowsetta.BBoxinstance or a PythonSequenceofcrowsetta.BBoxinstances.