快捷方式

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]

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


© 版權所有 2024,Torchaudio 貢獻者。

使用 Sphinx 構建,主題由 Read the Docs 提供。

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源