birdnet_tiny_forge.datasets package

class birdnet_tiny_forge.datasets.AudioDataset(filepath: str, credentials: dict[str, Any] = None, fs_args: dict[str, Any] = None)

Bases: AbstractDataset[ndarray, ndarray]

load() tuple[ndarray, int | float]

Loads data from the audio file as [-1, 1] float32.

Returns:

a numpy array containing float32 data for the loaded audio file

save(out: WavItem) None

Saves data by delegation to the provided save method.

Args:

data: the value to be saved by provided save method.

Raises:

DatasetError: when underlying save method raises error. FileNotFoundError: when save method got file instead of dir, on Windows. NotADirectoryError: when save method got file instead of dir, on Unix.

class birdnet_tiny_forge.datasets.BatchedParquetDataset(*, filepath: str, load_args: dict[str, Any] | None = None, save_args: dict[str, Any] | None = None, version: Version | None = None, credentials: dict[str, Any] | None = None, fs_args: dict[str, Any] | None = None, metadata: dict[str, Any] | None = None)

Bases: ParquetDataset

load() DataFrame

Loads data by delegation to the provided load method.

Returns:

Data returned by the provided load method.

Raises:

DatasetError: When underlying load method raises error.

save(batch_loaders: dict[str, Callable]) None
Parameters:

batch_loaders – a dict mapping strings to callables, each returning a pandas dataframe with same schema.

class birdnet_tiny_forge.datasets.KerasModelDataset(filepath: str, credentials: dict[str, Any] = None, fs_args: dict[str, Any] = None)

Bases: AbstractDataset[Model, Model]

load() keras.Model

Loads model

Returns:

a Keras model

save(model: keras.Model) None

Saves data by delegation to the provided save method.

Args:

data: the value to be saved by provided save method.

Raises:

DatasetError: when underlying save method raises error. FileNotFoundError: when save method got file instead of dir, on Windows. NotADirectoryError: when save method got file instead of dir, on Unix.

class birdnet_tiny_forge.datasets.TFDataset(filepath: str, credentials: Dict[str, Any] = None, fs_args: Dict[str, Any] = None)

Bases: AbstractDataset[Dataset, Dataset]

load() tensorflow.data.Dataset

Loads data by delegation to the provided load method.

Returns:

Data returned by the provided load method.

Raises:

DatasetError: When underlying load method raises error.

save(data: tensorflow.data.Dataset) None

Tars contents of directory

class birdnet_tiny_forge.datasets.TarDataset(filepath: str, temp_extract_path: str = None, credentials: dict[str, Any] = None, fs_args: dict[str, Any] = None)

Bases: AbstractDataset[Path, Path]

load() Path

Extracts tar to temporary directory, returns the directory.

save(dir: Path) None

Tars contents of directory

Submodules

birdnet_tiny_forge.datasets.batched_parquet_dataset module

A save-only kedro dataset that, given a dict of callable loaders, iterates through them appending to a parquet file. Loading one batch at a time can help cap RAM usage for large datasets when lazy loading techniques are used.

class birdnet_tiny_forge.datasets.batched_parquet_dataset.BatchedParquetDataset(*, filepath: str, load_args: dict[str, Any] | None = None, save_args: dict[str, Any] | None = None, version: Version | None = None, credentials: dict[str, Any] | None = None, fs_args: dict[str, Any] | None = None, metadata: dict[str, Any] | None = None)

Bases: ParquetDataset

load() DataFrame

Loads data by delegation to the provided load method.

Returns:

Data returned by the provided load method.

Raises:

DatasetError: When underlying load method raises error.

save(batch_loaders: dict[str, Callable]) None
Parameters:

batch_loaders – a dict mapping strings to callables, each returning a pandas dataframe with same schema.

birdnet_tiny_forge.datasets.keras_model_dataset module

Simple dataset to load/save keras3 models

class birdnet_tiny_forge.datasets.keras_model_dataset.KerasModelDataset(filepath: str, credentials: dict[str, Any] = None, fs_args: dict[str, Any] = None)

Bases: AbstractDataset[Model, Model]

load() keras.Model

Loads model

Returns:

a Keras model

save(model: keras.Model) None

Saves data by delegation to the provided save method.

Args:

data: the value to be saved by provided save method.

Raises:

DatasetError: when underlying save method raises error. FileNotFoundError: when save method got file instead of dir, on Windows. NotADirectoryError: when save method got file instead of dir, on Unix.

birdnet_tiny_forge.datasets.tar_dataset module

TarDataset saves a directory to a tar.gz file, or loads one by first extracting to a temporary directory, and returning the path to the temp directory

class birdnet_tiny_forge.datasets.tar_dataset.TarDataset(filepath: str, temp_extract_path: str = None, credentials: dict[str, Any] = None, fs_args: dict[str, Any] = None)

Bases: AbstractDataset[Path, Path]

load() Path

Extracts tar to temporary directory, returns the directory.

save(dir: Path) None

Tars contents of directory

birdnet_tiny_forge.datasets.tf_dataset module

Save/load tensorflow datasets

class birdnet_tiny_forge.datasets.tf_dataset.TFDataset(filepath: str, credentials: Dict[str, Any] = None, fs_args: Dict[str, Any] = None)

Bases: AbstractDataset[Dataset, Dataset]

load() tensorflow.data.Dataset

Loads data by delegation to the provided load method.

Returns:

Data returned by the provided load method.

Raises:

DatasetError: When underlying load method raises error.

save(data: tensorflow.data.Dataset) None

Tars contents of directory

birdnet_tiny_forge.datasets.wav_dataset module