🚀 基於WSJ0 - 3Mix數據集訓練的SepFormer模型
本倉庫提供了使用 SepFormer 模型進行音頻源分離所需的所有工具。該模型使用SpeechBrain實現,並在WSJ0 - 3Mix數據集上進行了預訓練。為了獲得更好的使用體驗,我們建議您進一步瞭解 SpeechBrain。該模型在WSJ0 - 3Mix數據集測試集上的SI - SNRi指標為19.8 dB。
版本發佈日期 |
測試集SI - SNRi |
測試集SDRi |
2021年3月9日 |
19.8dB |
20.0dB |
🚀 快速開始
安裝SpeechBrain
首先,請使用以下命令安裝SpeechBrain:
pip install speechbrain
請注意,我們建議您閱讀相關教程,進一步瞭解 SpeechBrain。
在您自己的音頻文件上進行源分離
from speechbrain.inference.separation import SepformerSeparation as separator
import torchaudio
model = separator.from_hparams(source="speechbrain/sepformer-wsj03mix", savedir='pretrained_models/sepformer-wsj03mix')
est_sources = model.separate_file(path='speechbrain/sepformer-wsj03mix/test_mixture_3spks.wav')
torchaudio.save("source1hat.wav", est_sources[:, :, 0].detach().cpu(), 8000)
torchaudio.save("source2hat.wav", est_sources[:, :, 1].detach().cpu(), 8000)
torchaudio.save("source3hat.wav", est_sources[:, :, 2].detach().cpu(), 8000)
該系統期望輸入的錄音採樣率為8kHz(單聲道)。如果您的信號採樣率不同,請在使用該接口之前對其進行重採樣(例如,使用torchaudio或sox)。
在GPU上進行推理
若要在GPU上進行推理,在調用 from_hparams
方法時添加 run_opts={"device":"cuda"}
。
訓練
該模型使用SpeechBrain(fc2eabb7)進行訓練。若要從頭開始訓練,請按照以下步驟操作:
- 克隆SpeechBrain倉庫:
git clone https://github.com/speechbrain/speechbrain/
- 安裝依賴:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 運行訓練腳本:
cd recipes/WSJ0Mix/separation
python train.py hparams/sepformer.yaml --data_folder=your_data_folder
注意:請在yaml文件中將 num_spks
修改為3。
您可以在 此處 找到我們的訓練結果(模型、日誌等)。
侷限性
SpeechBrain團隊不保證該模型在其他數據集上的性能表現。
📚 詳細文檔
引用SpeechBrain
@misc{speechbrain,
title={{SpeechBrain}: A General-Purpose Speech Toolkit},
author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
year={2021},
eprint={2106.04624},
archivePrefix={arXiv},
primaryClass={eess.AS},
note={arXiv:2106.04624}
}
引用SepFormer
@inproceedings{subakan2021attention,
title={Attention is All You Need in Speech Separation},
author={Cem Subakan and Mirco Ravanelli and Samuele Cornell and Mirko Bronzi and Jianyuan Zhong},
year={2021},
booktitle={ICASSP 2021}
}
📄 許可證
本項目採用Apache 2.0許可證。
📋 關於SpeechBrain
- 官網:https://speechbrain.github.io/
- 代碼倉庫:https://github.com/speechbrain/speechbrain/
- HuggingFace頁面:https://huggingface.co/speechbrain/