nemo_curator.stages.audio.filtering.band_filter_module.predict

View as Markdown

Module Contents

Classes

NameDescription
BandPredictorClass to predict band label (full_band/narrow_band) for audio waveforms.

API

class nemo_curator.stages.audio.filtering.band_filter_module.predict.BandPredictor(
model_path: str,
feature_cache_size: int = 100
)

Class to predict band label (full_band/narrow_band) for audio waveforms.

feature_cache
dict = {}
nemo_curator.stages.audio.filtering.band_filter_module.predict.BandPredictor._load_model() -> None

Load the model from disk.

nemo_curator.stages.audio.filtering.band_filter_module.predict.BandPredictor.extract_features_from_audio(
waveform: torch.Tensor,
sample_rate: int
) -> numpy.ndarray

Extract band energy features directly from waveform tensor.

Parameters:

waveform
torch.Tensor

Audio waveform tensor [channels, samples]

sample_rate
int

Sample rate of the audio

Returns: np.ndarray

Array of extracted features

nemo_curator.stages.audio.filtering.band_filter_module.predict.BandPredictor.predict_audio(
waveform: torch.Tensor,
sample_rate: int
) -> str

Predict whether an audio waveform is full band or narrow band.

Parameters:

waveform
torch.Tensor

Audio waveform tensor [channels, samples]

sample_rate
int

Sample rate of the audio

Returns: str

Prediction result as a string (‘full_band’ or ‘narrow_band’)