语言: "英文"
缩略图:
标签:
- 语音大脑
- 嵌入向量
- 指令
- 关键词
- 关键词检测
- PyTorch
- x向量
- TDNN
- 指令识别
- 音频分类
许可证: "Apache-2.0"
数据集:
- 谷歌语音指令
评估指标:
- 准确率
小部件:
- 示例标题: 语音指令 "向下"
源: https://cdn-media.huggingface.co/speech_samples/keyword_spotting_down.wav
- 示例标题: 语音指令 "前进"
源: https://cdn-media.huggingface.co/speech_samples/keyword_spotting_go.wav
基于x向量嵌入的谷歌语音指令识别
本仓库提供了使用SpeechBrain进行指令识别的所有必要工具,该模型已在谷歌语音指令数据集上预训练。数据集可在此下载。该数据集提供了小型训练集、验证集和测试集,适用于在短音频片段中检测单个关键词。该系统可识别以下12个关键词:
'是', '否', '上', '下', '左', '右', '开', '关', '停', '前进', '未知', '静音'
为获得更好体验,建议深入了解SpeechBrain。模型在测试集上的表现如下:
发布版本 |
准确率(%) |
2021-06-02 |
98.14 |
流程描述
该系统由TDNN模型结合统计池化构成,顶部应用了使用分类交叉熵损失训练的分类器。
系统训练采用16kHz采样率(单声道)的录音。调用classify_file时,代码会自动对音频进行标准化处理(如重采样和单声道选择)。
安装SpeechBrain
首先,请通过以下命令安装SpeechBrain:
pip install speechbrain
建议阅读我们的教程以了解更多关于SpeechBrain的信息。
执行指令识别
import torchaudio
from speechbrain.inference.classifiers 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推理
在GPU上执行推理时,调用from_hparams
方法时添加run_opts={"device":"cuda"}
参数。
训练
该模型使用SpeechBrain(b7ff9dc4版本)训练。从头训练步骤如下:
- 克隆SpeechBrain:
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=您的数据目录
训练结果(模型、日志等)可在此查看。
限制
SpeechBrain团队不保证该模型在其他数据集上的性能表现。
引用x向量
author = {David Snyder等},
title = {使用X-向量的口语识别},
booktitle = {Odyssey 2018},
pages = {105--111},
year = {2018},
}
引用谷歌语音指令
author = {Warden, P.},
title = "{语音指令:有限词汇语音识别数据集}",
journal = {arXiv预印本},
eprint = {1804.03209},
year = 2018,
url = {https://arxiv.org/abs/1804.03209},
}
关于SpeechBrain
- 官网: https://speechbrain.github.io/
- 代码库: https://github.com/speechbrain/speechbrain/
- HuggingFace: https://huggingface.co/speechbrain/
引用SpeechBrain
若在研究中使用了SpeechBrain,请引用我们。
@misc{speechbrain2021,
title={{SpeechBrain}: 通用语音工具包},
author={Ravanelli等},
year={2021},
eprint={2106.04624},
archivePrefix={arXiv},
primaryClass={eess.AS},
}