模型:

speechbrain/metricgan-plus-voicebank

英文

MetricGAN-trained model for Enhancement

本存储库提供了使用SpeechBrain进行语音增强所需的所有工具。为了获得更好的体验,我们鼓励您详细了解 SpeechBrain 。模型的性能为:

Release Test PESQ Test STOI
21-04-27 3.15 93.0

安装 SpeechBrain

首先,请使用以下命令安装SpeechBrain:

pip install speechbrain

请注意,我们鼓励您阅读我们的教程并详细了解 SpeechBrain

预训练模型用法

要使用Mimic-loss训练的模型进行增强,请使用以下简单的代码:

import torch
import torchaudio
from speechbrain.pretrained import SpectralMaskEnhancement

enhance_model = SpectralMaskEnhancement.from_hparams(
    source="speechbrain/metricgan-plus-voicebank",
    savedir="pretrained_models/metricgan-plus-voicebank",
)

# Load and add fake batch dimension
noisy = enhance_model.load_audio(
    "speechbrain/metricgan-plus-voicebank/example.wav"
).unsqueeze(0)

# Add relative length tensor
enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))

# Saving enhanced signal on disk
torchaudio.save('enhanced.wav', enhanced.cpu(), 16000)

当调用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
    

    您可以在 here 找到我们的训练结果(模型、日志等)。

    限制

    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

    引用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}
    }