🚀 基于xvector嵌入的Voxceleb说话人验证
本仓库提供了使用SpeechBrain的预训练TDNN模型提取说话人嵌入所需的所有工具。该系统在Voxceleb 1和Voxceleb2的训练数据上进行训练。
为了获得更好的体验,我们建议你进一步了解 SpeechBrain。该模型在Voxceleb1测试集(清理后)上的性能如下:
发布日期 |
EER(%) |
2021年3月5日 |
3.2 |
🚀 快速开始
安装SpeechBrain
首先,请使用以下命令安装SpeechBrain:
pip install speechbrain
请注意,我们建议你阅读我们的教程,进一步了解 SpeechBrain。
计算说话人嵌入
import torchaudio
from speechbrain.inference.speaker import EncoderClassifier
classifier = EncoderClassifier.from_hparams(source="speechbrain/spkrec-xvect-voxceleb", savedir="pretrained_models/spkrec-xvect-voxceleb")
signal, fs = torchaudio.load('tests/samples/ASR/spk1_snt1.wav')
embeddings = classifier.encode_batch(signal)
该系统使用采样率为16kHz(单声道)的录音进行训练。如果需要,调用 classify_file
时,代码会自动对音频进行归一化处理(即重采样和单声道选择)。如果你使用 encode_batch
和 classify_batch
,请确保输入张量的采样率符合要求。
在GPU上进行推理
要在GPU上进行推理,请在调用 from_hparams
方法时添加 run_opts={"device":"cuda"}
。
训练
该模型使用SpeechBrain(aa018540)进行训练。要从头开始训练,请按照以下步骤操作:
- 克隆SpeechBrain仓库:
git clone https://github.com/speechbrain/speechbrain/
- 安装依赖:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 运行训练:
cd recipes/VoxCeleb/SpeakerRec/
python train_speaker_embeddings.py hparams/train_x_vectors.yaml --data_folder=your_data_folder
你可以在 这里 找到我们的训练结果(模型、日志等)。
✨ 主要特性
管道描述
该系统由一个TDNN模型和统计池化组成,使用分类交叉熵损失进行训练。
📄 许可证
本项目采用Apache 2.0许可证。
引用xvectors
author = {David Snyder and
Daniel Garcia{-}Romero and
Alan McCree and
Gregory Sell and
Daniel Povey and
Sanjeev Khudanpur},
title = {Spoken Language Recognition using X-vectors},
booktitle = {Odyssey 2018},
pages = {105--111},
year = {2018},
}
引用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}
}
⚠️ 重要提示
SpeechBrain团队不对该模型在其他数据集上的性能提供任何保证。