模型:
speechbrain/google_speech_command_xvector
这个代码库提供了在SpeechBrain上使用预训练模型进行命令识别的所有必要工具。可以下载数据集 here 。该数据集提供了小型的训练、验证和测试集,适用于在短音频片段中检测单个关键词。提供的系统可以识别以下12个关键词:
'yes', 'no', 'up', 'down', 'left', 'right', 'on', 'off', 'stop', 'go', 'unknown', 'silence'
为了获得更好的体验,我们鼓励您了解 SpeechBrain 。该模型在测试集上的性能为:
Release | Accuracy(%) |
---|---|
06-02-21 | 98.14 |
该系统由一个带有统计汇聚的TDNN模型组成。在其上应用了一个使用分类交叉熵损失训练的分类器。
该系统使用16kHz(单声道)采样的录音进行训练。当调用 classify_file 时,代码将自动对音频进行规范化(即重新采样+选择单声道)。
首先,请使用以下命令安装SpeechBrain:
pip install speechbrain
请注意,我们鼓励您阅读我们的教程,了解更多关于 SpeechBrain 的信息。
import torchaudio from speechbrain.pretrained import EncoderClassifier classifier = EncoderClassifier.from_hparams(source="speechbrain/google_speech_command_xvector", savedir="pretrained_models/google_speech_command_xvector") out_prob, score, index, text_lab = classifier.classify_file('speechbrain/google_speech_command_xvector/yes.wav') print(text_lab) out_prob, score, index, text_lab = classifier.classify_file('speechbrain/google_speech_command_xvector/stop.wav') print(text_lab)
要在GPU上执行推理,请在调用 from_hparams 方法时添加 run_opts={"device":"cuda"}。
该模型是使用SpeechBrain(b7ff9dc4)训练的。要从头开始训练,请按照以下步骤进行:
git clone https://github.com/speechbrain/speechbrain/
cd speechbrain pip install -r requirements.txt pip install -e .
cd recipes/Google-speech-commands python train.py hparams/xvect.yaml --data_folder=your_data_folder
您可以在 here 中找到我们的训练结果(模型、日志等)。
使用此模型在其他数据集上的性能,SpeechBrain团队不提供任何保证。
参考xvectorsauthor = {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}, }参考Google语音命令
author = { {Warden}, P.}, title = "{Speech Commands: A Dataset for Limited-Vocabulary Speech Recognition}", journal = {ArXiv e-prints}, archivePrefix = "arXiv", eprint = {1804.03209}, primaryClass = "cs.CL", keywords = {Computer Science - Computation and Language, Computer Science - Human-Computer Interaction}, year = 2018, month = apr, url = {https://arxiv.org/abs/1804.03209}, }
如果您在研究或商业中使用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} }