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 模型,並載入預訓練權重。 :returns:
SquimObjective
的變體。