🚀 基于Libri3Mix训练的SepFormer模型
本仓库提供了使用 SepFormer 模型进行音频源分离所需的所有工具。该模型使用 SpeechBrain 实现,并在 Libri3Mix 数据集上进行了预训练。为了获得更好的使用体验,我们建议您进一步了解 SpeechBrain。该模型在 Libri3Mix 数据集测试集上的 SI - SNRi 性能达到 19.8 dB。
版本发布日期 |
测试集 SI - SNRi |
测试集 SDRi |
22年9月16日 |
19.0dB |
19.4dB |
🚀 快速开始
本项目提供了基于 SepFormer 模型进行音频源分离的工具,下面将介绍如何使用这些工具。
📦 安装指南
首先,请使用以下命令安装 SpeechBrain:
pip install speechbrain
请注意,我们建议您阅读我们的教程,进一步了解 SpeechBrain。
💻 使用示例
基础用法
在您自己的音频文件上执行源分离:
from speechbrain.pretrained import SepformerSeparation as separator
import torchaudio
model = separator.from_hparams(source="speechbrain/sepformer-libri3mix", savedir='pretrained_models/sepformer-libri3mix')
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/LibriMix/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}
}
@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},
📄 许可证
本项目采用 Apache 2.0 许可证。
关于 SpeechBrain
- 官网:https://speechbrain.github.io/
- 代码仓库:https://github.com/speechbrain/speechbrain/
- HuggingFace 页面:https://huggingface.co/speechbrain/
标签
- 源分离
- 语音分离
- 音频源分离
- Libri3Mix
- SepFormer
- Transformer
- 音频到音频
- 音频源分离
- SpeechBrain
数据集
评估指标