- 本文代码: https://github.com/AzizCode92/Listen-Attend-and-Spell-Pytorch
Listen, Attend and Spell (LAS)主要由两个部分组成,一个是接收语音信息的listener, 另一个是以字符作为输出的speller。其中listener将语音信号
Listener
相比于文本序列特征,即便语音转为频谱图特征,其序列长度也是非常长的。为了提高训练速度,本文提出了pyramidal Bi-LSTM (pBLSTM)的结构。在通常的LSTM中,在第
而在pBLSTM中,来自上层的输入不再是
pBLSTM的结构示意图如下所示:
![v2-61a430a51cb7c381469919d67cbbe11f_b.png](http://img-01.proxy.5ce.com/view/image?&type=2&guid=310384dd-bf2f-eb11-8da9-e4434bdf6706&url=https://pic4.zhimg.com/v2-61a430a51cb7c381469919d67cbbe11f_b.png)
本文中采用了3层pBLSTM,在上边的示意图中,只有第一层传到第二层,以及第二层传到第三层的时候序列长度发生了减半,实际上,在频谱信息输入到pBLSTM第一层的时候也进行了同样的操作。因此,listener最终输出的序列长度是原输入序列长度的
pytorch中实现pBLSTM的listener代码如下:
class
Speller
Speller根据时间序列依次预测每个时间步上的字符
利用该时刻的state
其具体的计算过程包括:
- 计算
与
中每一时刻
的scalar energy
- 利用softmax对
处理后得到
与
不同时刻相似程度的分布
- 以
为权重对
进行加权求和
相关公式表达如下:
其中
Attention的pytorch代码实现如下:
class
根据
其中
Speller的pytorch实现:
class
@inproceedings{chan2016listen,
title={Listen, attend and spell: A neural network for large vocabulary conversational speech recognition},
author={Chan, William and Jaitly, Navdeep and Le, Quoc and Vinyals, Oriol},
booktitle={2016 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
pages={4960--4964},
year={2016},
organization={IEEE}
}