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¶
方法¶
get_model¶
- SquimSubjectiveBundle.get_model() SquimSubjective[源]¶
構建 SquimSubjective 模型並載入預訓練權重。:返回:
SquimObjective的變體。