🚀 基於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團隊不對該模型在其他數據集上的性能提供任何保證。