Skip to content

process#

audioclass.batch.process #

Module for batch processing audio data with classification models.

Attributes#

Classes#

Functions#

process_iterable(process_array, iterable, tags, name, confidence_threshold=DEFAULT_THRESHOLD) #

Process an iterable of audio data using a models process_array method.

This function iterates over batches of audio clips, processes each clip using the provided process_array function, and returns a list of ClipPrediction objects. The process_array function should take a numpy array of audio data and return a tuple of class probabilities and extracted features.

Parameters:

Name Type Description Default
process_array Callable[[ndarray], Tuple[ndarray, ndarray]]

A function that takes a numpy array of audio data and returns a tuple of class probabilities and extracted features.

required
iterable BaseIterator

An iterator that yields batches of audio clips.

required
tags List[Tag]

A list of tags that the model can predict.

required
name str

The name of the model.

required
confidence_threshold float

The minimum confidence threshold for a tag to be included in a prediction. Defaults to DEFAULT_THRESHOLD.

DEFAULT_THRESHOLD

Returns:

Type Description
List[ClipPrediction]

A list of ClipPrediction objects, one for each audio clip.