Paper commentary
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
Object-level attention lifts captioning and VQA past fixed grid attention
- Problem Captioning and VQA models usually attend over a fixed grid of CNN cells, which ignores image content. A coarse grid loses detail, while a fine grid splits objects across many cells.
- Method Bottom-Up and Top-Down attention uses a Faster R-CNN to propose object regions, instead of grid cells. A top-down attention LSTM then weights those region features for captioning and VQA.
- Results On the MSCOCO test server, an ensemble reached CIDEr 117.9, SPICE 21.5 and BLEU-4 36.9. The same approach took first place in the 2017 VQA Challenge.
Why attention over a fixed grid falls short
Captioning and visual question answering both often require fine-grained visual reading and sometimes several steps of reasoning, which is why attention over CNN features has become standard in both tasks. Most of these models attend over the output of one or more CNN layers by scoring each spatial cell, conditioned on a partial caption or a question, so the attended units are the cells of a uniform grid.
The size of that grid creates a trade-off: a coarse grid loses detail, while a fine grid breaks objects into many cells. Because the cells are placed without regard to content, an object can be poorly aligned with the cells that describe it, which makes it harder to bind the visual concepts belonging to that object.
Earlier work that used salient regions relied on selective search, edge boxes or spatial transformers, which are either hand-crafted or differentiable proposal schemes that cannot be pretrained on object detection data. Using Faster R-CNN instead lets the region proposals be pretrained on detection datasets, which the authors compare to pretraining visual representations on ImageNet.
Region features from a bottom-up detector
Faster R-CNN works in two stages: a Region Proposal Network slides over an intermediate CNN feature map and predicts an objectness score and box refinement for anchors of several scales and aspect ratios. After non-maximum suppression with an IoU threshold, the highest-ranked proposals go to a second stage, where region of interest pooling extracts a small feature map per box, and the final layers output class scores and box refinements.
For captioning and VQA, the detector's final output is filtered per object class with non-maximum suppression, and a region is kept when any class probability exceeds a confidence threshold. Each kept region is represented by its mean-pooled convolutional feature, which is 2048-dimensional in this model, and only these vectors are used downstream, not the predicted labels.
Since the model only keeps a limited set of boxes from many candidate configurations, the authors describe it as functioning like a hard attention mechanism.
The detector is initialized from a ResNet-101 pretrained on ImageNet and then trained on Visual Genome object annotations. The original four Faster R-CNN loss components are kept, and an extra multi-class attribute loss is added.
Starting from 2,000 object classes and 500 attribute classes, the authors manually removed abstract classes that detected poorly, leaving 1,600 object classes and 400 attribute classes. Overlapping classes such as person, man and guy, singular and plural forms, and classes that are hard to localize were deliberately kept.
How the captioner attends over regions
The captioner has two LSTM layers: the first acts as a top-down attention model and the second as a language model. The input to the attention LSTM at each step joins the previous output of the language LSTM, the mean of the region features, and the embedding of the previous word, which gives it the state of the language model, the overall image content and the partial caption.
The word embedding is learned from random initialization without pretraining.
The attended feature \(\hat{v}_t\) is the weighted sum of all region features with those weights, so it is a convex combination of the regions.
The language LSTM takes the attended feature concatenated with the attention LSTM output as its input. A softmax over the vocabulary gives the conditional distribution of each word, and the sequence probability is the product of these conditionals.
Training the captioner with cross-entropy and CIDEr
The base objective is the cross-entropy loss \(L_{XE}(\theta)=-\sum_{t=1}^{T}\log p_\theta(y^*_t\mid y^*_{1:t-1})\), which is minimized over the ground-truth sequence. For CIDEr optimization, the model starts from the cross-entropy model and minimizes the negative expected reward \(L_R(\theta)=-E[r(y_{1:T})]\), with \(r\) being the score function such as CIDEr.
The gradient is estimated with Self-Critical Sequence Training, where a sampled caption is weighted by its reward minus the reward of the greedily decoded caption. The authors restrict sampling to the captions in the beam produced by beam search, reasoning that the beam usually contains at least one high-scoring caption while unrestricted samples rarely beat the greedy caption.
With this restriction, CIDEr optimization was completed in a single epoch.
How the VQA model combines question and regions
The question is encoded as the hidden state of a GRU over learned word embeddings. Each region receives an unnormalized score \(a_i=w_a^{T}f_a([v_i,q])\), and the normalized weights and attended feature are computed as in the captioning model.
The learned nonlinear layers are gated tanh layers, which compute \(\tilde{y}=\tanh(Wx+b)\), a gate \(g=\sigma(W'x+b')\), and \(y=\tilde{y}\circ g\), where \(\circ\) is the Hadamard product.
The question and attended image features pass through separate gated tanh layers and are combined by an element-wise product into a joint representation \(h\). A sigmoid over a linear layer applied to \(h\) gives the distribution over candidate answers, which is trained as a multi-label classifier over a fixed answer set. Full architecture details and hyperparameter choices are given in a separate reference rather than in this paper.
Datasets and preprocessing
Visual Genome has 108K images with scene graphs and 1.7M visual question answers; only its object and attribute annotations are used for pretraining the detector. Of its images, 5K are held out for validation, 5K for later testing, and 98K for training. About 51K Visual Genome images also appear in MSCOCO captions, so images found in both data sets are placed in the same split in each.
Caption evaluation uses the Karpathy splits of MSCOCO 2014, which have 113,287 training images with five captions each and 5K images each for validation and testing. The test server submission is trained on the full MSCOCO 2014 training and validation data, 123K images. Captions are lower-cased, split on white space, and words occurring fewer than five times are removed, giving a vocabulary of 10,010 words.
VQA v2.0 has 1.1M questions and 11.1M answers, and it balances answers to reduce the effect of dataset priors. Questions are trimmed to 14 words, and the output vocabulary contains correct training answers that appear more than 8 times, a set of 3,129 answers. For training, Visual Genome question and answer pairs are added when their answer is in the output vocabulary, which amounts to about 30% of the available data or 485K questions.
Captioning results
The ResNet baseline encodes the full image with the final convolutional layer of ResNet-101, bilinearly resized to a 10×10 grid, which matches the maximum number of regions in the full model. Under cross-entropy training, the Up-Down model reached CIDEr 113.5 against 105.4 for the ResNet baseline on the Karpathy test split. The baseline itself is slightly better than the SCST cross-entropy models on most metrics, and slightly worse after CIDEr optimization.
With CIDEr optimization, the Up-Down model reached 120.1 CIDEr against 111.1 for the ResNet baseline and 114.0 for SCST with the Att2all model. Across BLEU-1, BLEU-4, METEOR, ROUGE-L, CIDEr and SPICE, the relative gains of the Up-Down model over the ResNet baseline lie between 3-8% under either training objective. The SCST numbers come from the best of four random initializations, whereas the Up-Down numbers come from a single initialization.
The SPICE breakdown shows the Up-Down model ahead of the ResNet baseline on object, attribute and relation categories under both training objectives. The authors describe this improvement as broadly based across these categories.
On the MSCOCO test server, a four-model ensemble trained with CIDEr optimization reached CIDEr 117.9 on the c5 reference set and 120.5 on c40, with SPICE 21.5 and BLEU-4 36.9. The authors report that this submission outperformed the previously published entries on all reported metrics, and at the time of submission on 18 July 2017 it also outperformed unpublished server submissions.
VQA results
For VQA, the baseline encodes the resized input image with ResNet-200, and the spatial output is varied between 14×14, 7×7 and 1×1. On the VQA v2.0 validation set, the single Up-Down model reached 63.2 overall, against 56.3, 57.9 and 59.4 for the 1×1, 14×14 and 7×7 ResNet variants. The Up-Down model scored 80.3 on yes/no, 42.8 on number and 55.8 on other questions, and the authors report a 6% relative gain over the best ResNet baseline overall.
The ResNet baselines use about twice as many convolutional layers as the bottom-up model, which the authors note when interpreting the gap.
On the VQA v2.0 test-standard server, an ensemble of 30 models reached 70.34 overall accuracy, above the next entry HDU-USYD-UNCC at 68.09. The authors state that the submission, as of 8 August 2017, outperformed the other test server entries and took first place in the 2017 VQA Challenge.
What the attention maps show
The candidate regions overlap and vary in scale and aspect ratio, each aligned to an object, to several related objects or to a salient patch, so attention can land on fine details or large areas. The authors also describe a qualitative pattern in which the concepts of one object are co-located within a candidate region and are processed together.
The authors connect this to the feature binding problem in human vision, where attention is thought to play a central role, and present the link as a motivation for the design. These observations are visual inspections of selected examples, not a quantitative measure of attention quality.
Limits of the evidence
Both models use simple one-pass attention, and the more complex stacked, multi-headed or bidirectional attention schemes from prior work were not applied here. The region features are not fine-tuned in either model, and the reported results use a single model with no fine-tuning of the input ResNet or R-CNN.
The headline test-server results use ensembles, four models for captioning and 30 for VQA, while the VQA validation comparison uses a single model. The captioning comparison with SCST depends on the selection rule described above, so it should be read with that asymmetry in mind.
Visual Genome and MSCOCO share about 51K images, and the paper handles this overlap by placing shared images in matching splits rather than removing them. The object and attribute vocabularies were cleaned manually, and overlapping, singular and plural classes were retained by design.
Paper info
- Authors
- Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, Lei Zhang
- Venue
- arXiv · Preprint
- First published
- 2017-7-25
- Added
- 2026-11-11
- Updated
- 2018-3-14
- Version
- v3
- arXiv
- 1707.07998
- Category
- cs.CV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, Lei Zhang (2017). Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering. arXiv:1707.07998v3. https://arxiv.org/abs/1707.07998v3
BibTeX
@misc{anderson2017bottom,
title = {{Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering}},
author = {Peter Anderson and Xiaodong He and Chris Buehler and Damien Teney and Mark Johnson and Stephen Gould and Lei Zhang},
year = {2017},
eprint = {1707.07998},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1707.07998v3}
}