语言: "中文"
缩略图:
标签:
- 音频到音频
- 音频源分离
- 源分离
- 语音分离
- WHAM!
- SepFormer
- Transformer
- pytorch
- speechbrain
许可证: "apache-2.0"
评估指标:
- SI-SNRi
- SDRi
基于WHAMR!训练的SepFormer(16kHz采样频率)
本仓库提供了使用SepFormer模型进行音频源分离所需的所有工具,该模型由SpeechBrain实现,并在WHAMR!数据集上进行了预训练,采样频率为16kHz。WHAMR!本质上是WSJ0-Mix数据集的一个版本,包含了环境噪声和混响,采样率为16kHz。为了获得更好的体验,我们建议您了解更多关于SpeechBrain的信息。该模型在WHAMR!测试集上的性能为13.5 dB SI-SNRi。
发布版本 |
测试集SI-SNRi |
测试集SDRi |
30-03-21 |
13.5 dB |
13.0 dB |
安装SpeechBrain
首先,请使用以下命令安装SpeechBrain:
pip install speechbrain
请注意,我们建议您阅读我们的教程,了解更多关于SpeechBrain的信息。
对您自己的音频文件进行源分离
from speechbrain.inference.separation import SepformerSeparation as separator
import torchaudio
model = separator.from_hparams(source="speechbrain/sepformer-whamr16k", savedir='pretrained_models/sepformer-whamr16k')
est_sources = model.separate_file(path='speechbrain/sepformer-whamr16k/test_mixture16k.wav')
torchaudio.save("source1hat.wav", est_sources[:, :, 0].detach().cpu(), 16000)
torchaudio.save("source2hat.wav", est_sources[:, :, 1].detach().cpu(), 16000)
该系统期望输入的录音采样率为16kHz(单声道)。如果您的信号采样率不同,请在使用接口前重新采样(例如使用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/WHAMandWHAMR/separation/
python train.py hparams/sepformer-whamr.yaml --data_folder=your_data_folder --sample_rate=16000
您可以在这里找到我们的训练结果(模型、日志等)。
限制
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}
}
关于SpeechBrain
- 网站: https://speechbrain.github.io/
- 代码: https://github.com/speechbrain/speechbrain/
- HuggingFace: https://huggingface.co/speechbrain/