快捷鍵

SourceSeparationBundle

class torchaudio.pipelines.SourceSeparationBundle[source]

用於執行音源分離的組件的資料類別。

範例
>>> import torchaudio
>>> from torchaudio.pipelines import CONVTASNET_BASE_LIBRI2MIX
>>> import torch
>>>
>>> # Build the separation model.
>>> model = CONVTASNET_BASE_LIBRI2MIX.get_model()
>>> 100%|███████████████████████████████|19.1M/19.1M [00:04<00:00, 4.93MB/s]
>>>
>>> # Instantiate the test set of Libri2Mix dataset.
>>> dataset = torchaudio.datasets.LibriMix("/home/datasets/", subset="test")
>>>
>>> # Apply source separation on mixture audio.
>>> for i, data in enumerate(dataset):
>>>     sample_rate, mixture, clean_sources = data
>>>     # Make sure the shape of input suits the model requirement.
>>>     mixture = mixture.reshape(1, 1, -1)
>>>     estimated_sources = model(mixture)
>>>     score = si_snr_pit(estimated_sources, clean_sources) # for demonstration
>>>     print(f"Si-SNR score is : {score}.)
>>>     break
>>> Si-SNR score is : 16.24.
>>>
使用 SourceSeparationBundle 的教學
Music Source Separation with Hybrid Demucs

使用 Hybrid Demucs 進行音樂音源分離

使用 Hybrid Demucs 進行音樂音源分離

屬性

sample_rate

property SourceSeparationBundle.sample_rate: int

模型訓練所用音訊的採樣率。

類型:

int

方法

get_model

SourceSeparationBundle.get_model() Module[source]

建構模型並載入預訓練權重。

文件

存取 PyTorch 的完整開發者文件

查看文件

教學

為初學者和進階開發者取得深入教學

查看教學

資源

尋找開發資源並獲得解答

查看資源