语言: "zh"
标签:
- 音频转音频
- 语音增强
- PyTorch
- SpeechBrain
许可证: "apache-2.0"
数据集:
- Voicebank
- DEMAND
评估指标:
- PESQ
- STOI
推理: false
基于MetricGAN训练的语音增强模型
本仓库提供了使用SpeechBrain进行语音增强所需的所有工具。为了获得更好的体验,我们建议您了解更多关于SpeechBrain的信息。该模型的性能如下:
发布版本 |
测试PESQ |
测试STOI |
21-04-27 |
3.15 |
93.0 |
安装SpeechBrain
首先,请使用以下命令安装SpeechBrain:
pip install speechbrain
请注意,我们鼓励您阅读我们的教程,了解更多关于SpeechBrain的信息。
预训练模型的使用
要使用基于模仿损失训练的模型进行语音增强,可以使用以下简单代码:
import torch
import torchaudio
from speechbrain.inference.enhancement import SpectralMaskEnhancement
enhance_model = SpectralMaskEnhancement.from_hparams(
source="speechbrain/metricgan-plus-voicebank",
savedir="pretrained_models/metricgan-plus-voicebank",
)
noisy = enhance_model.load_audio(
"speechbrain/metricgan-plus-voicebank/example.wav"
).unsqueeze(0)
enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
torchaudio.save('enhanced.wav', enhanced.cpu(), 16000)
该系统使用采样率为16kHz(单声道)的录音进行训练。当调用enhance_file时,代码会自动对您的音频进行标准化处理(即重采样+单声道选择)。如果您像示例中那样使用enhance_batch,请确保您的输入张量符合预期的采样率。
在GPU上进行推理
要在GPU上执行推理,请在调用from_hparams
方法时添加run_opts={"device":"cuda"}
。
训练
该模型使用SpeechBrain(d0accc8)进行训练。要从头开始训练,请按照以下步骤操作:
- 克隆SpeechBrain:
git clone https://github.com/speechbrain/speechbrain/
- 安装:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 运行训练:
cd recipes/Voicebank/enhance/MetricGAN
python train.py hparams/train.yaml --data_folder=your_data_folder
您可以在此处找到我们的训练结果(模型、日志等)这里。
局限性
SpeechBrain团队不保证该模型在其他数据集上的性能。
引用MetricGAN+
如果您发现MetricGAN+有用,请引用:
@article{fu2021metricgan+,
title={MetricGAN+: An Improved Version of MetricGAN for Speech Enhancement},
author={Fu, Szu-Wei and Yu, Cheng and Hsieh, Tsun-An and Plantinga, Peter and Ravanelli, Mirco and Lu, Xugang and Tsao, Yu},
journal={arXiv preprint arXiv:2104.03538},
year={2021}
}
关于SpeechBrain
- 网站: https://speechbrain.github.io/
- 代码: https://github.com/speechbrain/speechbrain/
- HuggingFace: https://huggingface.co/speechbrain/
引用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}
}