🚀 語音增強的MetricGAN訓練模型
本倉庫提供了使用SpeechBrain進行語音增強所需的所有工具。為了獲得更好的體驗,我們建議您進一步瞭解 SpeechBrain。該模型的性能如下:
發佈版本 |
測試PESQ |
測試STOI |
21-04-27 |
3.15 |
93.0 |
🚀 快速開始
本倉庫提供了使用 SpeechBrain 進行語音增強所需的全部工具。為獲得更佳體驗,建議您深入瞭解 SpeechBrain。
✨ 主要特性
- 提供了使用 SpeechBrain 進行語音增強的工具。
- 展示了模型在測試集上的 PESQ 和 STOI 指標。
📦 安裝指南
首先,請使用以下命令安裝 SpeechBrain:
pip install speechbrain
請注意,我們建議您閱讀我們的教程,進一步瞭解 SpeechBrain。
💻 使用示例
基礎用法
要使用經過 mimic-loss 訓練的模型進行語音增強,請使用以下簡單代碼:
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}
}
📄 許可證
本項目採用 Apache-2.0 許可證。