ECAPA-TDNN说话人模型
ECAPA-TDNN模型是基于时延神经网络构建的说话人模型,由于识别性能优异,已经被广泛使用在说话人识别领域中,还可用于说话人日志和语种识别等任务。
模型结构简述
ECAPA-TDNN在传统的TDNN模型上有3种改进。第一,融合了一维的Res2Net层和Squeeze-and-Excitation模块,对特征channel之间的关系进行建模。第二,融合多个层级特征,同时利用网络浅层和深层的信息。第三,采用了基于attention机制的pooling层,生成基于全局attention的说话人特征。
更详细的信息见
- ECAPA-TDNN论文:ECAPA-TDNN: Emphasized Channel Attention, Propagation and Aggregation in TDNN Based Speaker Verification
- 3D-Speaker数据集:3D-Speaker: A Large-Scale Multi-Device, Multi-Distance, and Multi-Dialect Corpus for Speech Representation Disentanglement
- github项目地址:3D-Speaker
训练数据
本模型使用开源数据集3D-Speaker数据集进行训练,包含约10k个说话人,可以对16k采样率的中文音频进行识别。
模型效果评估
在3D-Speaker中文测试集:Cross Device, Cross-Distance, Cross-Dialect中EER评测结果如下:
Model | Params | Cross-Device | Cross-Distance | Cross-Dialect |
---|---|---|---|---|
ECAPA-TDNN | 20.8M | 9.07% | 12.71% | 14.90% |
快速体验模型效果
在Notebook中体验
对于有开发需求的使用者,特别推荐您使用Notebook进行离线处理。先登录ModelScope账号,点击模型页面右上角的“在Notebook中打开”按钮出现对话框,首次使用会提示您关联阿里云账号,按提示操作即可。关联账号后可进入选择启动实例界面,选择计算资源,建立实例,待实例创建完成后进入开发环境,输入api调用实例。
from modelscope.pipelines import pipeline
sv_pipeline = pipeline(
task='speaker-verification',
model='damo/speech_ecapa-tdnn_sv_zh-cn_3dspeaker_16k'
)
speaker1_a_wav = 'https://modelscope.cn/api/v1/models/damo/speech_campplus_sv_zh-cn_16k-common/repo?Revision=master&FilePath=examples/speaker1_a_cn_16k.wav'
speaker1_b_wav = 'https://modelscope.cn/api/v1/models/damo/speech_campplus_sv_zh-cn_16k-common/repo?Revision=master&FilePath=examples/speaker1_b_cn_16k.wav'
speaker2_a_wav = 'https://modelscope.cn/api/v1/models/damo/speech_campplus_sv_zh-cn_16k-common/repo?Revision=master&FilePath=examples/speaker2_a_cn_16k.wav'
# 相同说话人语音
result = sv_pipeline([speaker1_a_wav, speaker1_b_wav])
print(result)
# 不同说话人语音
result = sv_pipeline([speaker1_a_wav, speaker2_a_wav])
print(result)
# 可以自定义得分阈值来进行识别
result = sv_pipeline([speaker1_a_wav, speaker2_a_wav], thr=0.6)
print(result)
训练和测试自己的ECAPA-TDNN模型
本项目已在3D-Speaker开源了训练、测试和推理代码,使用者可按下面方式下载安装使用:
git clone https://github.com/alibaba-damo-academy/3D-Speaker.git && cd 3D-Speaker
conda create -n 3D-Speaker python=3.8
conda activate 3D-Speaker
pip install -r requirements.txt
运行ECAPA-TDNN在3D-Speaker集上的训练脚本
cd egs/3dspeaker/sv-ecapa
bash run.sh
使用本预训练模型快速提取embedding
pip install modelscope
cd 3D-Speaker
# 配置模型名称并指定wav路径,wav路径可以是单个wav,也可以包含多条wav路径的list文件
model_id=damo/speech_ecapa-tdnn_sv_zh-cn_3dspeaker_16k
# 提取embedding
python speakerlab/bin/infer_sv.py --model_id $model_id --wavs $wav_path
相关论文以及引用信息
如果你觉得这个该模型有所帮助,请引用下面的相关的论文
@article{desplanques2020ecapa,
title={Ecapa-tdnn: Emphasized channel attention, propagation and aggregation in tdnn based speaker verification},
author={Desplanques, Brecht and Thienpondt, Jenthe and Demuynck, Kris},
journal={arXiv preprint arXiv:2005.07143},
year={2020}
}
@inproceedings{chen2023pushing,
title={3D-Speaker: A Large-Scale Multi-Device, Multi-Distance, and Multi-Dialect Corpus for Speech Representation Disentanglement},
author={Siqi Zheng, Luyao Cheng, Yafeng Chen, Hui Wang and Qian Chen},
url={https://arxiv.org/pdf/2306.15354.pdf},
year={2023}
}
评论