tensorflow#
Warning
Additional Dependencies: To use the Tensorflow iterator, you will need to install additional dependencies. These dependencies are optional, as they can be heavy and may not be needed in all use cases. To install them, run:
audioclass.batch.tensorflow
#
Module for providing a TensorFlow Dataset-based audio batch iterator.
Classes:
Name | Description |
---|---|
TFDatasetIterator |
A TensorFlow Dataset-based audio batch iterator. |
Attributes#
Classes#
TFDatasetIterator(recordings, samplerate, input_samples, batch_size=BATCH_SIZE, audio_dir=None)
#
Bases: BaseIterator
A TensorFlow Dataset-based audio batch iterator.
This iterator leverages TensorFlow's Dataset API to efficiently load, preprocess, and batch audio data for model training and inference. It provides parallel loading and preprocessing capabilities, making it suitable for large datasets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recordings
|
List[Recording]
|
A list of |
required |
samplerate
|
int
|
The target sample rate for resampling the audio data (in Hz). |
required |
input_samples
|
int
|
The number of samples per audio frame. |
required |
batch_size
|
int
|
The number of audio frames per batch. Defaults to |
BATCH_SIZE
|
audio_dir
|
Optional[Path]
|
The directory containing the audio files. Defaults to None. |
None
|