Shortcuts

VGGishBundle

class torchaudio.prototype.pipelines.VGGishBundle[source]

VGGish [Hershey et al., 2017] inference pipeline ported from torchvggish and tensorflow-models.

Example

>>> import torchaudio
>>> from torchaudio.prototype.pipelines import VGGISH
>>>
>>> input_sr = VGGISH.sample_rate
>>> input_proc = VGGISH.get_input_processor()
>>> model = VGGISH.get_model()
>>>
>>> waveform, sr = torchaudio.load(
>>>     "Chopin_Ballade_-1_In_G_Minor,_Op._23.mp3",
>>> )
>>> waveform = waveform.squeeze(0)
>>> waveform = torchaudio.functional.resample(waveform, sr, input_sr)
>>> mono_output = model(input_proc(waveform))

Properties

sample_rate

property VGGishBundle.sample_rate: int

Sample rate of input waveform expected by input processor and model.

Type:

int

Methods

get_input_processor

VGGishBundle.get_input_processor() VGGishInputProcessor[source]

Constructs input processor for VGGish.

Returns:

input processor for VGGish.

Return type:

VGGishInputProcessor

get_model

VGGishBundle.get_model() VGGish[source]

Constructs pre-trained VGGish model. Downloads and caches weights as necessary.

Returns:

VGGish model with pre-trained weights loaded.

Return type:

VGGish

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources