语言:
- 英语
缩略图: 无
标签:
- 音频分类
- speechbrain
- 嵌入向量
- 口音识别
- pytorch
- wav2vec2
- XLSR
- CommonAccent
- 英语
许可证: MIT
数据集:
- CommonVoice
评估指标:
- 准确率
小部件示例:
- 示例标题: 美国口音
音频链接: https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/us_1.wav
- 示例标题: 苏格兰口音
音频链接: https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/scotland_1.wav
- 示例标题: 马来西亚口音
音频链接: https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/malaysia_1.wav
- 示例标题: 菲律宾口音
音频链接: https://huggingface.co/Jzuluaga/accent-id-commonaccent_xlsr-en-english/resolve/main/data/philippines_1.wav
CommonAccent:基于CommonVoice探索大规模声学预训练模型用于口音分类
基于XLSR模型的英语口音分类器
摘要:
尽管自动语音识别(ASR)技术近期取得进展,带口音语音的识别仍是核心难题。研究表明,将口音信息整合至ASR框架可有效减少口音导致的识别错误,从而构建更具包容性的系统。我们通过ECAPA-TDNN和Wav2Vec 2.0/XLSR架构解决多语言口音分类问题,这些架构已被证实在多种语音下游任务中表现优异。我们提供了基于Common Voice 7.0(英语)和11.0(意大利语、德语、西班牙语)的简易口音分类方案,并与SpeechBrain工具包深度整合。其中英语口音分类准确率最高达95%,刷新当前最佳记录。通过t-SNE可视化分析Wav2Vec 2.0嵌入向量的内部聚类特征,发现其能依据音系相似性形成层级化聚类结构。
本代码库提供基于SpeechBrain实现语音口音识别的全套工具。系统使用在CommonAccent英语数据集(16种口音)上预训练的模型,其开发框架源自CommonLanguage配方项目:https://github.com/speechbrain/speechbrain/tree/develop/recipes/CommonLanguage
该系统可识别英语短语音中的以下16种口音:
- 美国
- 英格兰
- 澳大利亚
- 印度
- 加拿大
- 百慕大
- 苏格兰
- 非洲
- 爱尔兰
- 新西兰
- 威尔士
- 马来西亚
- 菲律宾
- 新加坡
- 香港
- 南大西洋
代码库链接:https://github.com/JuanPZuluaga/accent-recog-slt2022
注意:由于模型与当前SpeechBrain接口的兼容性问题,暂无法提供推理API。请按照**"从语音录音进行口音识别"**章节的步骤使用该英语口音识别模型。建议访问SpeechBrain官网获取更佳使用体验。
技术架构
该系统由微调后的XLSR模型结合统计池化层构成,顶层采用基于NLL Loss训练的线性分类器。模型训练采用16kHz单通道音频,调用classify_file时会自动进行音频标准化(重采样+单声道选择)。若使用encode_batch和classify_batch,请确保输入张量符合预期采样率。
安装SpeechBrain
执行以下命令安装:
pip install speechbrain
从语音录音进行口音识别
import torchaudio
from speechbrain.pretrained.interfaces import foreign_class
classifier = foreign_class(source="Jzuluaga/accent-id-commonaccent_xlsr-en-english", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
out_prob, score, index, text_lab = classifier.classify_file('Jzuluaga/accent-id-commonaccent_xlsr-en-english/data/us.wav')
print(text_lab)
out_prob, score, index, text_lab = classifier.classify_file('Jzuluaga/accent-id-commonaccent_xlsr-en-english/data/philippines.wav')
print(text_lab)
GPU推理
在调用from_hparams
方法时添加run_opts={"device":"cuda"}
参数即可启用GPU推理。
训练流程
- 克隆SpeechBrain:
git clone https://github.com/speechbrain/speechbrain/
- 安装依赖:
cd speechbrain
pip install -r requirements.txt
pip install -e .
- 克隆我们的代码库:
git clone https://github.com/JuanPZuluaga/accent-recog-slt2022
cd CommonAccent/accent_id
python train_w2v2.py hparams/train_w2v2.yaml
完整训练结果(模型、日志等)可在本仓库"Files and versions"页面查看。
限制声明
SpeechBrain团队不对该模型在其他数据集上的表现提供任何保证。
引用CommonAccent研究
若使用本工作,请引用:
@article{zuluaga2023commonaccent,
title={CommonAccent: Exploring Large Acoustic Pretrained Models for Accent Classification Based on Common Voice},
author={Zuluaga-Gomez, Juan and Ahmed, Sara and Visockas, Danielius and Subakan, Cem},
journal={Interspeech 2023},
url={https://arxiv.org/abs/2305.18283},
year={2023}
}
引用XLSR模型
@article{conneau2020unsupervised,
title={Unsupervised cross-lingual representation learning for speech recognition},
author={Conneau, Alexis and Baevski, Alexei and Collobert, Ronan and Mohamed, Abdelrahman and Auli, Michael},
journal={arXiv preprint arXiv:2006.13979},
year={2020}
}
引用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}
}