🚀 基于Libri2Mix训练的SepFormer模型
本仓库提供了使用 SepFormer 模型进行音频源分离所需的所有工具。该模型使用 SpeechBrain 实现,并在 Libri2Mix 数据集上进行了预训练。为了获得更好的体验,我们建议您进一步了解 SpeechBrain。该模型在 Libri2Mix 数据集测试集上的性能达到了 20.6 dB。
属性 |
详情 |
标签 |
源分离、语音分离、音频源分离、Libri2Mix、SepFormer、Transformer、音频到音频、音频源分离、speechbrain |
许可证 |
Apache-2.0 |
数据集 |
Libri2Mix |
评估指标 |
SI - SNRi、SDRi |
版本发布日期 |
测试集 SI - SNRi |
测试集 SDRi |
2022 年 9 月 16 日 |
20.6dB |
20.9dB |
您可以通过 此处 收听在 WSJ0 - 2/3Mix 测试集上获得的示例结果。
🚀 快速开始
本仓库提供了使用基于 SpeechBrain 实现的 SepFormer 模型进行音频源分离的必要工具,该模型在 Libri2Mix 数据集上进行了预训练。为获得更好的使用体验,建议您进一步了解 SpeechBrain。该模型在 Libri2Mix 数据集测试集上的性能为 20.6 dB。
📦 安装指南
安装 SpeechBrain
首先,请使用以下命令安装 SpeechBrain:
pip install speechbrain
建议您阅读我们的教程,进一步了解 SpeechBrain。
💻 使用示例
基础用法
在您自己的音频文件上进行源分离:
from speechbrain.pretrained import SepformerSeparation as separator
import torchaudio
model = separator.from_hparams(source="speechbrain/sepformer-libri2mix", savedir='pretrained_models/sepformer-libri2mix')
est_sources = model.separate_file(path='speechbrain/sepformer-wsj02mix/test_mixture.wav')
torchaudio.save("source1hat.wav", est_sources[:, :, 0].detach().cpu(), 8000)
torchaudio.save("source2hat.wav", est_sources[:, :, 1].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/Libri2Mix/separation
python train.py hparams/sepformer.yaml --data_folder=your_data_folder
您可以在 此处 找到我们的训练结果(模型、日志等)。
局限性
SpeechBrain 团队不对该模型在其他数据集上的性能提供任何保证。
📄 许可证
本项目采用 Apache - 2.0 许可证。
🔖 参考文献
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}
}
@article{subakan2023exploring,
author={Subakan, Cem and Ravanelli, Mirco and Cornell, Samuele and Grondin, François and Bronzi, Mirko},
journal={IEEE/ACM Transactions on Audio, Speech, and Language Processing},
title={Exploring Self-Attention Mechanisms for Speech Separation},
year={2023},
volume={31},
pages={2169-2180},
}
关于 SpeechBrain
- 官网:https://speechbrain.github.io/
- 代码仓库:https://github.com/speechbrain/speechbrain/
- HuggingFace 页面:https://huggingface.co/speechbrain/