快捷方式

SquimSubjectiveBundle

class torchaudio.pipelines.SquimSubjectiveBundle[源]

捆绑关联信息以使用预训练的 SquimSubjective 模型的数据类。

此类提供用于实例化预训练模型的接口,以及检索预训练权重和与模型一起使用的额外数据所需的信息。

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

此捆绑包可以估计语音增强的主观度量分数,例如 MOS。典型的用例流程为:波形 -> 分数。请参见下面的代码示例。

示例:估计输入波形的主观度量分数。
>>> import torch
>>> import torchaudio
>>> from torchaudio.pipelines import SQUIM_SUBJECTIVE as bundle
>>>
>>> # Load the SquimSubjective bundle
>>> model = bundle.get_model()
Downloading: "https://download.pytorch.org/torchaudio/models/squim_subjective_bvcc_daps.pth"
100%|████████████| 360M/360M [00:09<00:00, 41.1MB/s]
>>>
>>> # Resample audio to the expected sampling rate
>>> waveform = torchaudio.functional.resample(waveform, sample_rate, bundle.sample_rate)
>>> # Use a clean reference (doesn't need to be the reference for the waveform) as the second input
>>> reference = torchaudio.functional.resample(reference, sample_rate, bundle.sample_rate)
>>>
>>> # Estimate subjective metric scores
>>> score = model(waveform, reference)
>>> print(f"MOS: {score}.")

属性

sample_rate

property SquimSubjectiveBundle.sample_rate

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

类型

float

方法

get_model

SquimSubjectiveBundle.get_model() SquimSubjective[源]

构建 SquimSubjective 模型并加载预训练权重。:返回:SquimObjective 的变体。

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

获取面向初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题解答

查看资源