crowsetta.formats.bbox.audbbox.AudBBox#
- class crowsetta.formats.bbox.audbbox.AudBBox(df: DataFrame, annot_path: Path, audio_path=None)[source]#
Bases:
object
Class that represents Audacity label tracks in extended format, exported to txt files https://manual.audacityteam.org/man/importing_and_exporting_labels.html#Extended_format_with_frequency_ranges
- df#
with annotations loaded into it
- Type:
- annot_path#
Path to Audacity txt file from which annotations were loaded.
- Type:
- audio_path#
Path to audio file that the Audacity txt file annotates.
- Type:
str. pathlib.Path
- __init__(df: DataFrame, annot_path: Path, audio_path=None) None #
Method generated by attrs for class AudBBox.
Methods
__init__
(df, annot_path[, audio_path])Method generated by attrs for class AudBBox.
from_file
(annot_path[, audio_path])Load annotations from an Audacity annotation file with bounding boxes, created by exporting a Selection Table.
to_annot
()Convert this Audacity bbox annotation to a
crowsetta.Annotation
.to_bbox
()Convert this Audacity extended label track annotation to a
list
ofcrowsetta.Bbox
.to_file
(annot_path)Make a txt file from this annotation in extended label track format that can be read by Audacity.
Attributes
COLUMNS_MAP
- classmethod from_file(annot_path: PathLike, audio_path: PathLike | None = None) Self [source]#
Load annotations from an Audacity annotation file with bounding boxes, created by exporting a Selection Table.
- Parameters:
annot_path (str, pathlib.Path) – Path to a txt file exported from Audacity bbox.
audio_path (str, pathlib.Path) – Path to audio file that the Audacity bbox txt file annotates. Optional, defaults to None.
Examples
>>> example = crowsetta.data.get('aud-bbox') >>> audbbox = crowsetta.formats.bbox.AudBBox.from_file(example.annot_path)
- to_annot() Annotation [source]#
Convert this Audacity bbox annotation to a
crowsetta.Annotation
.- Returns:
annot
- Return type:
Examples
>>> example = crowsetta.data.get('aud-bbox') >>> audacitybbox = crowsetta.formats.bbox.AudBBox.from_file(example.annot_path) >>> annot = audacitybbox.to_annot()
- to_bbox() List[BBox] [source]#
Convert this Audacity extended label track annotation to a
list
ofcrowsetta.Bbox
.- Returns:
bboxes – A
list
ofcrowsetta.BBox
instances.- Return type:
Examples
>>> example = crowsetta.data.get('aud-bbox') >>> audbbox = crowsetta.formats.bbox.AudBBox.from_file(example.annot_path) >>> bboxes = audbbox.to_bbox()