快捷方式

SquimObjectiveBundle

class torchaudio.pipelines.SquimObjectiveBundle[source]

Data class that bundles associated information to use pretrained SquimObjective model.

此类提供用于实例化预训练模型以及检索预训练权重和模型附加数据所需信息的接口。

Torchaudio 库会实例化此类对象,每个对象代表一个不同的预训练模型。客户端代码应通过这些实例访问预训练模型。

This bundle can estimate objective metric scores for speech enhancement, such as STOI, PESQ, Si-SDR. A typical use case would be a flow like waveform -> list of scores. Please see below for the code example.

Example: Estimate the objective metric scores for the input waveform.
>>> import torch
>>> import torchaudio
>>> from torchaudio.pipelines import SQUIM_OBJECTIVE as bundle
>>>
>>> # Load the SquimObjective bundle
>>> model = bundle.get_model()
Downloading: "https://download.pytorch.org/torchaudio/models/squim_objective_dns2020.pth"
100%|████████████| 28.2M/28.2M [00:03<00:00, 9.24MB/s]
>>>
>>> # Resample audio to the expected sampling rate
>>> waveform = torchaudio.functional.resample(waveform, sample_rate, bundle.sample_rate)
>>>
>>> # Estimate objective metric scores
>>> scores = model(waveform)
>>> print(f"STOI: {scores[0].item()},  PESQ: {scores[1].item()}, SI-SDR: {scores[2].item()}.")

属性

sample_rate

property SquimObjectiveBundle.sample_rate

模型训练所使用的音频的采样率。

类型

浮点数

方法

get_model

SquimObjectiveBundle.get_model() SquimObjective[source]

Construct the SquimObjective model, and load the pretrained weight.

返回

Variation of SquimObjective.

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源