论文笔记:Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
来源:互联网 发布:明星页游 知乎 编辑:程序博客网 时间:2024/05/16 11:10
论文链接:Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
Bottom-Up Attention Model
本文的bottom up attention 模型在后面的image caption部分和VQA部分都会被用到。
这里用的是object detection领域的Faster R-CNN方法来提取,详细的就不再说了。
其中把提取出的region的mean-pooled convolutional feature定义为
因为只有小部分的bounding box会被选择出来, Faster R-CNN可以看作是一种hard attention机制。
bottom up attetion model在完成imageNet的预训练后,又到visual genome数据上进行了训练。
为了学习到更好的特征表示,除了预测object class以外,他们额外加了一个训练输出,来预测region
本文保留了Faster R-CNN的损失函数,并在此基础上加了一个multi-class loss来训练attribute predictor。
Image Caption部分
Caption model结构如图所示,共有2个LSTM模块,一个是Language LSTM,另一个是Top-Down Attention LSTM。
这里两个LSTM都是用的标准LSTM,因此就简化表述了:
其中,对于LSTM的输入
这个模型的结构很有意思,两个LSTM都在互相使用对方前一个时刻的隐状态,具体结合公式来看。
top-down attention LSTM
top-down attention使用LSTM来确定image feature
而top-down attention LSTM的输入
- 前一时刻language model的hidden state
h2t−1 - k个image feature的 mean-pooled feature
v¯=1k∑ivi - 之前生成的词的encoding(
Πt 为t时刻输入单词的one-hot encoding,We 为embedding矩阵。)
这三者concatenate而成。
PS:论文原文提到:
These inputs provide the attention LSTM with maximum context regarding the state of the language LSTM, the overall content of the image, and the partial caption output generated so far, respectively.
而公式上只是输入了几个局部的image feature,而不是整张图片,个人认为严格意义上这不能等同于overall content of the image
对于k个image feature
其中
简单来说,
language LSTM
language LSTM的输入
- attention feature加权和
vt^ - 当前时刻attention LSTM的hidden state
h1t
concatenate而成。
在t 时刻输出的任一单词的概率分布
而整个句子的概率分布
训练目标
文章首先使用的是最小化cross entropy
另外文章还用到了SCST中的强化学习方法来对CIDEr分数进行优化:
梯度可以被近似为:
其中
具体需要原理和推导需要看原论文以及强化学习相关理论。
本文使用beam size为5的beam search进行decode,并且发现,在这个size下通常会包含至少一个质量非常高(分数很高)的句子,而且这个句子的log概率通常不会很高。因此为了减少计算量,在强化学习的优化过程中,本文就只在beam search decode出来的句子中进行sample。
VQA部分
VQA模型也同样使用的是 soft top-down attention机制,结构如图所示:
对问题和图片进行joint multimodal embedding。
对于网络内的非线性变换,这里是用gated hyperbolic tangent activation来实现的,是highway network的一种形式。对于每一个gated tanh层,都是用如下方式来实现映射
其中
对于这个非线性变换,2017 VQA Challenge 第一名技术报告提到:
本质上就是原来的 tanh 激励上根据获得的 gate 进行了 mask,其实是跟 LSTM 和 GRU 中间非线性用的是一样的。
VQA中的问题Q被编码成GRU内的隐状态
其中对于k个image features
而normalized attention weight
输出响应
其中
实验结果
总的来说,image caption和VQA部分的结果都是当时state-of-the-art的,但是VQA部分的分析较少,就只放image caption的分析了。
这里的Resnet是文章选取的一个baseline模型,用来代替bottom-up attention机制。也就是说这个baseline模型只有top-down的attention机制。
可以看到,无论有没有加CIDEr的强化学习训练、有没有使用bottom-up机制,本文的模型都比SCST的方法要好。而且SCST是从4个随机初始化的模型里面选了一个最好的,而本文这里的对比就只用了一个模型。
本文也试验了4个模型ensemble后的结果:
可以看到,本文的模型跟其他模型相比提升非常大。
本文还做了个实验证明本文bottom up attention机制的作用:
根据实验显示,如果没有清晰的视觉信息的引导的话,模型可能会过分依赖于语言中的上下文信息,因此不能很好地识别出一些out-of-context的图片。
(在SCST中也做了out-of-context的图片实验,如果使用attention模型加cross-entropy训练的话是不能准确识别出out-of-context的图片的,加了CIDEr优化以后才能很好地识别出out-of-context的图片。本文这个实验中的Up-Down模型应该也是经过CIDEr优化的,那么这里的结果到底是因为强化学习的效果还是attention的效果呢?)
总结
总的来说,本文主要的贡献在于提出了Bottom-Up and Top-Down Attention的机制,如果跟前面Image Captioning with Semantic Attention的对比的话,主要区别就是:
后者提出的只是一个个的单词,来指代检测到的物体,不包含空间的信息;而前者是一个feature vector,包含空间信息的同时还可以对应多个单词,比如一个形容词和名词,表现力更丰富了。
另外,个人认为两个LSTM之前互相利用对方隐状态这一架构设计也非常有意思。
- 论文笔记:Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
- 论文笔记: Hierarchical Question-Image Co-Attention for Visual Question Answering
- Hierarchical Question-Image Co-Attention for Visual Question Answering
- Hierarchical Question-Image Co-Attention for Visual Question Answering
- 论文笔记 :Multimodal Compact Bilinear Pooling for Visual Question Answering and Visual Grounding
- 论文研读--Stacked Attention Networks for Image Question Answering
- Ask, Attend and Answer: Exploring Question-Guided Spatial Attention for Visual Question Answering
- 论文笔记:Ask, Attend and Answer: Exploring Question-Guided Spatial Attention for Visual Question Answeri
- Top-down and bottom-up parser
- Stacked Attention Networks for Image Question Answering
- 论文笔记:Image Captioning with Semantic Attention
- Exploring Models and Data for Image Question Answering
- End-to-end Concept Word Detection for Video Captioning, Retrieval, and Question Answering
- 阅读笔记(Multimodal Compact Bilinear Pooling for Visual Question Answering and Visual Grounding)
- Dynamic Memory Networks for Visual and Textual Question Answering
- [深度学习论文笔记][Attention]Show, Attend, and Tell: Neural Image Caption Generation with Visual Attention
- Multimodal Compact Bilinear Pooling for Visual Question Answering and Visual Grounding
- ABC-CNN: An Attention Based Convolutional Neural Network for Visual Question Answering
- 头像上传前本地预览功能的实现(兼容ie8)
- Azure Visual Studio 2017 虚拟机镜像正式上线
- 数据结构及算法
- matlab查看源代码
- 文本框只能输入数字、字母,屏蔽粘贴
- 论文笔记:Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
- mysql 配置查询缓存
- mui-class说明(持续更新中~~)
- 详细告诉你“注册/登录”产品设计路上要闪避的坑
- 模拟器adb连不上的问题
- Android 内存泄漏 LeakCanary 来检查
- springmvc整合apache-poi实现数据下载
- element 2.0 基础使用
- 51nod 1829 函数(组合数+容斥)