模型:
speechbrain/spkrec-ecapa-voxceleb
此存储库提供了使用SpeechBrain预训练的ECAPA-TDNN模型进行说话人验证的所有必要工具。该系统还可以用于提取说话人嵌入。它在Voxceleb 1 + Voxceleb2训练数据上进行了训练。
为了获得更好的体验,我们鼓励您了解更多关于 SpeechBrain 的信息。该模型在Voxceleb1-test set(已清理)上的性能为:
Release | EER(%) |
---|---|
05-03-21 | 0.80 |
该系统由一个ECAPA-TDNN模型组成。它由卷积和残差块组成。使用关注统计汇集来提取嵌入。该系统使用附加边界softmax损失进行训练。说话人验证使用说话人嵌入之间的余弦距离进行。
首先,请使用以下命令安装SpeechBrain:
pip install speechbrain
请注意,我们鼓励您阅读我们的教程并了解更多关于 SpeechBrain 的信息。
import torchaudio from speechbrain.pretrained import EncoderClassifier classifier = EncoderClassifier.from_hparams(source="speechbrain/spkrec-ecapa-voxceleb") signal, fs =torchaudio.load('tests/samples/ASR/spk1_snt1.wav') embeddings = classifier.encode_batch(signal)
该系统使用以16kHz采样的录音进行训练(单声道)。当调用 classify_file 时,代码将自动对音频进行归一化(即重新采样+选择单声道),如果需要的话。如果使用 encode_batch和classify_batch,请确保输入张量符合预期的采样率。
from speechbrain.pretrained import SpeakerRecognition verification = SpeakerRecognition.from_hparams(source="speechbrain/spkrec-ecapa-voxceleb", savedir="pretrained_models/spkrec-ecapa-voxceleb") score, prediction = verification.verify_files("tests/samples/ASR/spk1_snt1.wav", "tests/samples/ASR/spk2_snt1.wav") # Different Speakers score, prediction = verification.verify_files("tests/samples/ASR/spk1_snt1.wav", "tests/samples/ASR/spk1_snt2.wav") # Same Speaker
如果输入中的两个信号来自同一说话人,则预测值为1,否则为0。
要在GPU上执行推理,请在调用from_hparams方法时添加 run_opts={"device":"cuda"}。
该模型是使用SpeechBrain(aa018540)进行训练的。要从头开始训练,请按照以下步骤进行:
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_ecapa_tdnn.yaml --data_folder=your_data_folder
您可以在这里找到我们的训练结果(模型、日志等) here 。
SpeechBrain团队不对在其他数据集上使用此模型时的性能提供任何保证。
引用ECAPA-TDNN模型@inproceedings{DBLP:conf/interspeech/DesplanquesTD20, author = {Brecht Desplanques and Jenthe Thienpondt and Kris Demuynck}, editor = {Helen Meng and Bo Xu and Thomas Fang Zheng}, title = {{ECAPA-TDNN:} Emphasized Channel Attention, Propagation and Aggregation in {TDNN} Based Speaker Verification}, booktitle = {Interspeech 2020}, pages = {3830--3834}, publisher = {{ISCA}}, year = {2020}, }
如果您在研究或业务中使用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} }