crowsetta.formats.bbox.raven.Raven#
- class crowsetta.formats.bbox.raven.Raven(df: DataFrame, annot_path: Path, annot_col: str, audio_path=None)[source]#
Bases:
object
Class that represents txt annotation files from Raven (https://ravensoundsoftware.com/software/), created by exporting a Selection Table.
- df#
with annotations loaded into it
- Type:
- annot_path#
Path to Raven txt file from which annotations were loaded.
- Type:
- audio_path#
Path to audio file that the Raven txt file annotates.
- Type:
str. pathlib.Path
- __init__(df: DataFrame, annot_path: Path, annot_col: str, audio_path=None) None #
Method generated by attrs for class Raven.
Methods
__init__
(df, annot_path, annot_col[, audio_path])Method generated by attrs for class Raven.
from_file
(annot_path[, annot_col, audio_path])Load annotations from a Raven annotation file, created by exporting a Selection Table.
to_annot
()Convert this Raven annotation to a
crowsetta.Annotation
.to_bbox
()Convert this Raven annotation to a
list
ofcrowsetta.Bbox
instances.to_file
(annot_path)Make a txt file that can be read by Raven from this annotation
Attributes
annot_col
COLUMNS_MAP
- classmethod from_file(annot_path: str | bytes | PathLike | Path, annot_col: str = 'Annotation', audio_path: str | bytes | PathLike | Path | None = None) Self [source]#
Load annotations from a Raven annotation file, created by exporting a Selection Table.
- Parameters:
annot_path (str, pathlib.Path) – Path to a txt file exported from Raven.
annot_col (str) – Name of column that contains annotations.
audio_path (str, pathlib.Path) – Path to audio file that the Raven txt file annotates. Optional, defaults to None.
Examples
>>> example = crowsetta.data.get('raven') >>> raven = crowsetta.formats.bbox.Raven.from_file(example.annot_path)
- to_annot() Annotation [source]#
Convert this Raven annotation to a
crowsetta.Annotation
.- Returns:
annot
- Return type:
Examples
>>> example = crowsetta.data.get('raven') >>> raven = crowsetta.formats.bbox.Raven.from_file(example.annot_path) >>> annot = raven.to_annot()
- to_bbox() List[BBox] [source]#
Convert this Raven annotation to a
list
ofcrowsetta.Bbox
instances.- Returns:
bboxes – A
list
ofcrowsetta.BBox
instances.- Return type:
Examples
>>> example = crowsetta.data.get('raven') >>> raven = crowsetta.formats.bbox.Raven.from_file(example.annot_path) >>> bboxes = raven.to_bbox()