bacpipe.core package

Submodules

bacpipe.core.audio_processor module

class bacpipe.core.audio_processor.AudioHandler(model, padding, audio_dir, bool_slowdown=False, slowdown_rate=None, **kwargs)[source]

Bases: object

Helper class for all methods related to loading and padding audio.

__init__(model, padding, audio_dir, bool_slowdown=False, slowdown_rate=None, **kwargs)[source]

Helper class for all methods related to loading and padding audio.

Parameters:
  • model (Model object) – has attributes for all the model characteristics like sample rate, segment length etc. as well as the methods to run the model

  • padding (str) – padding function to use for where padding is necessary

  • audio_dir (pathlib.Path object) – path to audio dir

prepare_audio(sample)[source]

Use bacpipe pipeline to load audio file, window it according to model specific window length and preprocess the data, ready for batch inference computation. Also log file length and shape for metadata files.

Parameters:

sample (pathlib.Path or str) – path to audio file

Returns:

audio frames preprocessed with model specific preprocessing

Return type:

torch.Tensor

bacpipe.core.constants module

bacpipe.core.constants.EMBEDDING_DIMENSIONS = {'audiomae': 768, 'audioprotopnet': 1024, 'aves_especies': 768, 'avesecho_passt': 768, 'bat': 64, 'beats': 768, 'biolingual': 512, 'birdaves_especies': 1024, 'birdmae': 1280, 'birdnet': 1024, 'convnext_birdset': 1024, 'google_whale': 1280, 'hbdet': 2048, 'insect459': 1280, 'insect66': 1280, 'mix2': 960, 'naturebeats': 768, 'perch_bird': 1280, 'perch_v2': 1536, 'protoclr': 384, 'rcl_fs_bsed': 2048, 'surfperch': 1280, 'vggish': 128}

model names with their corresponding embedding size

Type:

dict

bacpipe.core.constants.NEEDS_CHECKPOINT = ['audiomae', 'avesecho_passt', 'aves_especies', 'bat', 'beats', 'birdaves_especies', 'birdnet', 'hbdet', 'insect66', 'insect459', 'mix2', 'naturebeats', 'protoclr', 'rcl_fs_bsed']

models that require a checkpoint to be downloaded to be run

Type:

list[str]

bacpipe.core.constants.TF_MODELS = ['birdnet', 'perch_v2', 'perch_bird', 'google_whale', 'surfperch', 'vggish', 'hbdet']

models that were built using tensorflow

Type:

list[str]

bacpipe.core.constants.models_needing_checkpoint = ['audiomae', 'avesecho_passt', 'aves_especies', 'bat', 'beats', 'birdaves_especies', 'birdnet', 'hbdet', 'insect66', 'insect459', 'mix2', 'naturebeats', 'protoclr', 'rcl_fs_bsed']

Models that require a checkpoint to be downloaded before use.

Type:

list[str]

bacpipe.core.constants.supported_models = ['audiomae', 'audioprotopnet', 'avesecho_passt', 'aves_especies', 'bat', 'beats', 'birdaves_especies', 'biolingual', 'birdnet', 'birdmae', 'convnext_birdset', 'hbdet', 'insect66', 'insect459', 'mix2', 'naturebeats', 'perch_bird', 'perch_v2', 'protoclr', 'rcl_fs_bsed', 'surfperch', 'google_whale', 'vggish']

Supported embedding models available in bacpipe.

Type:

list[str]

bacpipe.core.experiment_manager module

bacpipe.core.workflows module

Module contents