深度学习
  • 前言
  • 第一章:经典网络
    • ImageNet Classification with Deep Convolutional Neural Network
    • Very Deep Convolutional Networks for Large-Scale Image Recognition
    • Going Deeper with Convolutions
    • Deep Residual Learning for Image Recognition
    • PolyNet: A Pursuit of Structural Diversity in Very Deep Networks
    • Squeeze-and-Excitation Networks
    • Densely Connected Convolutional Networks
    • SQUEEZENET: ALEXNET-LEVEL ACCURACY WITH 50X FEWER PARAMETERS AND <0.5MB MODEL SIZE
    • MobileNet v1 and MobileNet v2
    • Xception: Deep Learning with Depthwise Separable Convolutions
    • Aggregated Residual Transformations for Deep Neural Networks
    • ShuffleNet v1 and ShuffleNet v2
    • CondenseNet: An Efficient DenseNet using Learned Group Convolution
    • Neural Architecture Search with Reinforecement Learning
    • Learning Transferable Architectures for Scalable Image Recognition
    • Progressive Neural Architecture Search
    • Regularized Evolution for Image Classifier Architecture Search
    • 实例解析:12306验证码破解
  • 第二章:自然语言处理
    • Recurrent Neural Network based Language Model
    • Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation
    • Neural Machine Translation by Jointly Learning to Align and Translate
    • Hierarchical Attention Networks for Document Classification
    • Connectionist Temporal Classification : Labelling Unsegmented Sequence Data with Recurrent Neural Ne
    • About Long Short Term Memory
    • Attention Is All you Need
    • BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
  • 第三章:语音识别
    • Speech Recognition with Deep Recurrent Neural Network
  • 第四章:物体检测
    • Rich feature hierarchies for accurate object detection and semantic segmentation
    • Spatial Pyramid Pooling in Deep Convolutional Networks for Visual Recognition
    • Fast R-CNN
    • Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
    • R-FCN: Object Detection via Region-based Fully Convolutuional Networks
    • Mask R-CNN
    • You Only Look Once: Unified, Real-Time Object Detection
    • SSD: Single Shot MultiBox Detector
    • YOLO9000: Better, Faster, Stronger
    • Focal Loss for Dense Object Detection
    • YOLOv3: An Incremental Improvement
    • Learning to Segment Every Thing
    • SNIPER: Efficient Multi-Scale Training
  • 第五章:光学字符识别
    • 场景文字检测
      • DeepText: A Unified Framework for Text Proposal Generation and Text Detection in Natural Images
      • Detecting Text in Natural Image with Connectionist Text Proposal Network
      • Scene Text Detection via Holistic, Multi-Channel Prediction
      • Arbitrary-Oriented Scene Text Detection via Rotation Proposals
      • PixelLink: Detecting Scene Text via Instance Segmentation
    • 文字识别
      • Spatial Transform Networks
      • Robust Scene Text Recognition with Automatic Rectification
      • Bidirectional Scene Text Recognition with a Single Decoder
      • multi-task learning for text recognition with joint CTC-attention
    • 端到端文字检测与识别
      • Reading Text in the Wild with Convolutional Neural Networks
      • Deep TextSpotter: An End-to-End Trainable Scene Text Localization and Recognition Framework
    • 实例解析:字符验证码破解
    • 二维信息识别
      • 基于Seq2Seq的公式识别引擎
      • Show and Tell: A Neural Image Caption Generator
      • Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
  • 第六章:语义分割
    • U-Net: Convolutional Networks for Biomedical Image Segmentation
  • 第七章:人脸识别
    • 人脸检测
      • DenseBox: Unifying Landmark Localization with End to End Object Detection
      • UnitBox: An Advanced Object Detection Network
  • 第八章:网络优化
    • Batch Normalization
    • Layer Normalization
    • Weight Normalization
    • Instance Normalization
    • Group Normalization
    • Switchable Normalization
  • 第九章:生成对抗网络
    • Generative Adversarial Nets
  • 其它应用
    • Holistically-Nested Edge Detection
    • Image Style Transfer Using Convolutional Nerual Networks
    • Background Matting: The World is Your Green Screen
  • Tags
  • References
由 GitBook 提供支持
在本页
  • 简介
  • 详解
  • 1.1 Encoder
  • 1.2 Decoder
  • 1.3 实验数据可视化

这有帮助吗?

  1. 第二章:自然语言处理

Neural Machine Translation by Jointly Learning to Align and Translate

上一页Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation下一页Hierarchical Attention Networks for Document Classification

最后更新于4年前

这有帮助吗?

简介

在传统的RNN Encoder-Decoder模型中,在编码的过程中,将t−1t-1t−1时的状态h<t−1>h_{<t-1>}h<t−1>​和ttt时刻的数据x<t>x_{<t>}x<t>​输入到ttt时刻的RNN单元中,得到ttt时刻的状态h<t>h_{<t>}h<t>​,经过TTT个时间片后,得到长度等于隐节点数量的特征向量c\mathbf{c}c。在解码的过程中,将特征向量c\mathbf{c}c和上个时间片预测的输出y<t′−1>y_{<t'-1>}y<t′−1>​输入到RNN的单元中,得到该时刻的输出y<t′>y_{<t'>}y<t′>​,经过T′T'T′个时间片后得到输出结果。但在一些应用中,比如句子长度特别长的机器翻译场景中,传统的RNN Encoder-Decoder表现非常不理想。一个重要的原因是t′t't′时刻的输出可能更关心输入序列的某些部分是什么内容而和其它部分是什么关系并不大。例如在机器翻译中,当前时间片的输出可能仅更注重原句子的某几个单词而不是整个句子。

这篇论文率先提出了Attention的思想,通过Attention机制,模型可以同时学习原句子和目标句子的对齐关系和翻译关系。在编码过程中,将原句子编码成一组特征向量的一个集合,在翻译时,每个时间片会在该集合自行选择特征向量的一个子集用于产生输出结果。

详解

在这篇论文中,作者也是使用的RNN Encoder-Decoder结构。不同于传统的方式,在编码过程中,作者使用的是双向RNN(bi-RNN),每个RNN单元使用的是GRU。在解码过程中,使用的是基于Attention的GRU结构。算法结构如图1:

1.1 Encoder

双向RNN含有正向和反向两个方向,对于含有TTT个时间片的源句子XT={x1,x2,...,xT}X^T = \{x_1, x_2, ..., x_T\}XT={x1​,x2​,...,xT​},正向的输入数据是x1→x1→...→xTx_1 \rightarrow x_1 \rightarrow ... \rightarrow x_Tx1​→x1​→...→xT​,第ttt个时间片的隐节点h⃗t\vec{h}_tht​表示为

h⃗<t>=f(h⃗<t−1>,x<t>)\vec{h}_{<t>} = f(\vec{h}_{<t-1>}, x_{<t>})h<t>​=f(h<t−1>​,x<t>​)

反向数据的输入序列是xT→xT−1→...→x1x_T \rightarrow x_{T-1} \rightarrow ... \rightarrow x_1xT​→xT−1​→...→x1​,第ttt个时间片的隐节点h⃗t′\vec{h}'_tht′​表示为

h⃗<t>′=f(h⃗<t+1>′,x<t>)\vec{h}'_{<t>} = f(\vec{h}'_{<t+1>}, x_{<t>})h<t>′​=f(h<t+1>′​,x<t>​)

其中fff使用的是GRU的单元,详见上一篇论文的讲解。则第ttt个时间片的特征h<t>h_{<t>}h<t>​是前向和后向两个特征向量拼接到一起。

h<t>=[h⃗t;h⃗t′]Th_{<t>} = [\vec{h}_t; \vec{h}'_t]^Th<t>​=[ht​;ht′​]T

1.2 Decoder

在解码的过程中,传统的RNN Encoder-Decoder的方式将整个句子的特征向量作为输入

s<t>=f(s<t−1>,y<t−1>,c)s_{<t>} = f(s_{<t-1>}, y_{<t-1>}, c)s<t>​=f(s<t−1>​,y<t−1>​,c)

Attention模型是使用所有特征向量的加权和,通过对特征向量的权值的学习,我们可以使用对当前时间片最重要的特征向量的子集cic_ici​,即

s<t>=f(s<t−1>,y<t−1>,ci)s_{<t>} = f(s_{<t-1>}, y_{<t-1>}, c_i)s<t>​=f(s<t−1>​,y<t−1>​,ci​)

其中cic_ici​是h<t>h_{<t>}h<t>​的加权和

ci=∑t=1Tαithtc_i = \sum^{T}_{t=1} \alpha_{it}h_tci​=t=1∑T​αit​ht​
αit=exp(eit)∑k=1Texp(eik)\alpha_{it} = \frac{exp(e_{it})}{\sum_{k=1}^Texp(e_{ik})}αit​=∑k=1T​exp(eik​)exp(eit​)​
eit=a(s<i−1>,ht)e_{it} = a(s_{<i-1>}, h_t)eit​=a(s<i−1>​,ht​)

其中eite_{it}eit​是输出序列第iii个时间片的对齐模型,表示的是该时刻和输入数据每个时间片的相关程度。使用前一时刻的状态s<i−1>s_{<i-1>}s<i−1>​和第ttt个输入数据hth_tht​计算得到,在作者的实验中,aaa是使用的反正切tanh激活函数。

1.3 实验数据可视化

下图是通过可视化四组平行语料的α\alphaα值得到的图,α\alphaα值越大,表示两个数据相关性越强,图中的颜色越浅。