https://arxiv.org/pdf/1807.04445.pdf

摘要首先介绍RNN可以模拟复杂的序列信息的temporal dynamics,但是当前的RNN神经元的结构主要是控制当前信息和历史信息的贡献,但是没有考虑探索input vector中不同元素的重要性(这个指的是某一个时刻的vector的不同dimension的重要性),因此本文提出了element-wise-attention gate(EleAttG)加入到RNN block中,得到EleAtt-RNN block。提出的ElleAttG是一个additional fundamental unit,可以灵活地加到任何RNN结构中,是一个一般性的结构。最后,本文的模型在skeleton based action recognition和RGB based action recognition任务上都进行了测试,都显示加入这个模块后RNN的能力可以得到极大的提高。

对于EleAttG模块,一个简单直观的示意图如下

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

可以看出,这个模块的想法很是直截了当,通过历史的信息和当前的信息计算一个EleAttG,用计算好的东西对当前的输入读书笔记26:adding attentiveness to the neurons in recurrent neural networks的每一个维度的贡献进行一下modulation,得到一个读书笔记26:adding attentiveness to the neurons in recurrent neural networks,再用这个modulated的当前输入进行正常的RNN操作。

对于一个标准的RNN来说,t时刻的hidden state的计算如下,基于当前时刻的输入和上一时刻的hidden state

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

标准的RNN会有梯度消失的问题,LSTM解决了这个问题,GRU是一个比LSTM简单但是很相似的结构,其公式如下

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

GRU有两个gate,一个reset gate,一个是update gate,分别是读书笔记26:adding attentiveness to the neurons in recurrent neural networks读书笔记26:adding attentiveness to the neurons in recurrent neural networks,这个和基础的RNN相比来说,多了几个中间步骤,并且有些步骤被修改,首先,RNN是直接用当前的输入和之前的hidden state来获得当前的hidden state,而GRU是先用当前输入和上一步隐藏态获得一个reset gate,来决定上一步隐藏态的哪些dimension的信息要保留,哪些要去掉,接着用修饰过的隐藏态获得一个产生当前hidden state的前驱物h‘,这个h’的计算除了上一步的hidden state是修饰过的以外,操作是和标准的RNN完全一致的。产生最后的当前时刻hidden state的时候,还需要用到一个之前生成的update gate 读书笔记26:adding attentiveness to the neurons in recurrent neural networks,它控制着多少信息可以从前一时刻的hidden state流向当前时刻的hidden state,而读书笔记26:adding attentiveness to the neurons in recurrent neural networks起到的作用是,如果reset gate的元素都接近0,那么读书笔记26:adding attentiveness to the neurons in recurrent neural networks就和当前的输入xt很接近,也就倾向于将当前的hidden state重置为xt,而至于能否重置,还要看update gate是否允许,如果update gate的元素值也很小,力量很弱,那么最终得到的当前hidden state就基本上全是xt了。

LSTM的公式如下

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

这些模型启发本文作者的地方在于,这些模型在处理当前输入xt的时候都是当做一个整体来操作,没有像对待hidden state一样对每一个dimension进行控制,因此,本文就提出了对每一个dimension进行分配不同权重加以控制的方法,其实就是和不同的RNN变体一样,只不过这次多了一个对xt的不同元素的控制。

EleAttG模块得到的是一个向量读书笔记26:adding attentiveness to the neurons in recurrent neural networks,和当前输入xt维度相同,用来控制每一个dimension元素的贡献

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

可见,这个vector的计算和之前那些RNN模型中计算gate的方式一模一样,都是基于当前的输入和前一时刻的hidden state,只不过这次是作用在xt上了,这里面的读书笔记26:adding attentiveness to the neurons in recurrent neural networks就是一个sigmoid函数,W和b都是待训练的参数,这个式子的意思就是用上一时刻的hidden state和当前输入xt来巨鼎当前输入xt的每一个元素的重要程度。有了这个读书笔记26:adding attentiveness to the neurons in recurrent neural networks之后,就可以得到modulated input了,具体形式是

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

之后其他的计算就是基于读书笔记26:adding attentiveness to the neurons in recurrent neural networks而不是原始的当前输入xt了,EleAttG加入之后,对于不同的RNN模型,具体的操作方式不同,但是也就是将xt换成读书笔记26:adding attentiveness to the neurons in recurrent neural networks就行了,例如标准的RNN加入EleAttG之后就按下式

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

若是EleAttG-GRU,就是

读书笔记26:adding attentiveness to the neurons in recurrent neural networks

其他RNN网络以此类推,同理可得。

相关文章: