---
title: "Multiple Object Recognition with Visual Attention — Ba 2014"
description: "How recurrent visual attention learns where to look and how to read multiple digits, with results on handwritten digits and Street View images."
canonical: "https://research.elamur.ai/free/en/papers/ba-2014-multiple-object-recognition-visual-attention/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/ba-2014-multiple-object-recognition-visual-attention/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2014](https://md.research.elamur.ai/free/en/papers/2014/) / Multiple Object Recognition with Visual Attention

# Multiple Object Recognition with Visual Attention

Paper · 2014 · Jimmy Lei Ba, Volodymyr Mnih and Koray Kavukcuoglu

**Authors:** [Jimmy Lei Ba](https://md.research.elamur.ai/free/en/authors/jimmy-lei-ba/), [Volodymyr Mnih](https://md.research.elamur.ai/free/en/authors/volodymyr-mnih/) and [Koray Kavukcuoglu](https://md.research.elamur.ai/free/en/authors/koray-kavukcuoglu/) · **Year:** 2014 · **Venue:** arXiv (Cornell University) · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**637** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W1484210532) · [Cited by **67** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/ba-2014-multiple-object-recognition-visual-attention/cited-by/) · [arXiv (Cornell University)](https://openalex.org/S4306400194) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [PDF](https://arxiv.org/pdf/1412.7755)
- [arXiv 1412.7755](https://arxiv.org/abs/1412.7755)
- [OpenAlex](https://openalex.org/W1484210532)

Citations: OpenAlex, 2026-10-14.

## Summary

Reading a house number requires finding the digits, recognizing them in order, and knowing when the number ends. A system that examines an entire image in detail spends some of its computation on background, especially when the number occupies only a small part of the frame. In “Multiple Object Recognition with Visual Attention,” the authors train a system to decide where to look as it reads. During training, it receives the digit sequence for each image. It learns where to look without being given a location for each digit.

The deep recurrent attention network builds up its reading from small image crops called glimpses. A coarse view of the whole image helps it choose a starting point. Each glimpse then supplies fine detail near the chosen location and a lower-resolution view of the surrounding area. The network carries information from earlier glimpses into later decisions, using separate recurrent layers to choose where to look and to classify what it has seen. It produces the digits in a prescribed order and can emit a special label to mark the end of the sequence. Sampling different locations during training lets it explore, while a reward based on correct predictions helps it learn which choices to repeat.

The experiments move from handwritten digits to photographs of house fronts. On constructed MNIST images, the network learns to classify pairs of digits and achieves a 2.5% error rate when the target is their sum. The addition experiment supplies the answer without identifying the individual digits, and examples show the network looking back and forth between them. On Street View House Numbers, a reader that goes only from left to right trails the strongest convolutional comparison and frequently continues past the end of a number. Combining readers trained in opposite directions gives the paper’s best result on the standard task, surpassing the convolutional comparisons in whole-sequence recognition. The authors also report fewer parameters and a lower estimated computational cost.

Enlarged Street View crops test how the approach handles more area around a number. A reader trained on smaller crops can run directly on the larger images. The authors also use the locations chosen on an initial pass to extract a smaller crop for a second reading, recovering performance similar to that on tightly cropped inputs. The paper thus connects recognition to a concrete decision about computation. The system can use its own reading history to decide where more visual detail is worth processing, while the quality of the final transcription still depends on its stopping rule and on how it combines readings.

## Deep dive: Multiple Object Recognition with Visual Attention

How recurrent visual attention learns where to look and how to read multiple digits, with results on handwritten digits and Street View images. · about 35 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Finding the sequence is part of reading it

An image of a house front and the house number written on it are different kinds of input and output. The image has a spatial layout. The answer is an ordered sequence. The digits can occupy a limited region and run along a slope, while the surrounding image contains material irrelevant to transcription. Even a classifier that can identify a digit from a good crop needs some way to obtain that crop, decide which digit to read next, and tell when it has reached the end. A system evaluated on tightly centered numbers begins with some of those decisions already made by the cropping procedure.

The paper frames this as a problem of both supervision and computation. A transcription names the visible digits in order, but a lesson of the form “these are the digits” leaves the system to discover which image locations support each prediction. At the same time, increasing the image area makes it more expensive for a convolutional network to process the picture densely. A larger image can add locations to examine while leaving the amount of text the same. The paper asks whether a reader can learn to allocate detailed processing to a sequence of locations and make that allocation serve the transcription objective.

The authors place the problem against the success of convolutional networks in visual recognition. Convolution applies learned filters across an image, so increasing the spatial extent of its input increases the number of places at which the filters can be applied. The introduction cites work distributing such computation across graphics processors or across machines as evidence that scaling the standard approach already mattered in practice. One example of the earlier recognition work is [ImageNet Classification with Deep Convolutional Neural Networks](https://md.research.elamur.ai/free/en/papers/krizhevsky-2012-imagenet-classification-deep-convolutional/).

#### What earlier systems assumed about the input

A common approach to reading character sequences used a sliding window to find candidates and a separate classifier to identify them. The window examines successive areas, and a detector scores the likelihood that an area contains a target. Another way to provide locations is to generate proposals from the image before running recognition. Candidate regions can overlap, so a subsequent stage may suppress redundant detections. The authors point out that the components in such pipelines often have separate training objectives. Learning to propose promising regions and learning to name their contents are then distinct problems, even though their errors meet in the same final transcription.

The paper also describes an earlier end-to-end system for reading digits on checks. Its graph transformer architecture demonstrated that the stages of sequence recognition could be trained together. The authors distinguish their own approach by the origin of the candidate locations. The check reader still relied on specially designed extraction components, while the recurrent reader learns to propose its next location from the information it has acquired. That difference concerns the search procedure as well as the way the recognition objective reaches the rest of the system.

Other earlier work used the crop as the starting point. In the house-number recognizer discussed in the paper, each character position had its own classifier output, with the other weights shared. This gives the recognizer a way to predict several positions from the same input representation. The scene-text work described alongside it used synthetic text images for training and applied the resulting recognizer to cropped text in real images. These approaches establish why cropped recognition is a meaningful comparison. They also leave open the question of how to obtain a suitable region when the same content appears in a larger picture.

#### From a single target to a reading process

The most direct predecessor is the recurrent attention approach the authors call RAM. It had learned sequences of visual selections on cluttered digit classification and on a simplified visual control task. The open question was whether that form of attention could support several recognition decisions within one real image. An isolated-digit task can finish with one classification. A reader of house numbers must use a shared history across decisions and produce an output of the appropriate length.

The paper draws its intuition from reading by moving the point of detailed vision between relevant characters. In the architecture, a move selects the center of the next crop, which becomes the next observation. The analogy supplies a way to allocate computation. The technical proposal is to learn that allocation from the recognition task. The authors connect their derivation to both the reinforcement learning used in RAM and earlier work treating structured prediction as a sequence of decisions that can be trained with rewards. These precedents put two parts of the problem together. The network must accumulate visual evidence, and it must learn actions whose value is revealed by later predictions.

### The method, step by step

#### A coarse view gets the reader started

The authors first describe recognition with a single label. Imagine that the network has already looked at a small region and must choose where to look next. It needs a representation of what was visible there, where that observation came from, and what it had seen before. The glimpse network constructs a local feature vector. The recurrent layers combine it with the preceding state. A controller proposes the next coordinates, while a separate output network makes the classification when the allotted glimpses are complete.

The first move needs a source of information because there is no previous glimpse. The context network receives a downsampled view of the whole picture. Its output initializes the upper recurrent layer, which supplies the location controller. The lower recurrent layer begins with zeros and supplies the classifier. A broad, inexpensive view can therefore help place the first glimpse. The classification pathway begins to acquire image evidence when the glimpses arrive.

This separation also determines how context can influence later reading. The lower recurrent layer contributes to the upper layer at every step. Its observations thus help determine where the upper layer directs the controller next. The dependence in the other direction goes through the selected crop. A context-driven move exposes different visual evidence to the lower layer, changing what it can eventually predict. The authors designed this route to keep the coarse view from becoming a direct source of class predictions.

How the recurrent reader turns an image into labels The steps in order.

#### Each glimpse records appearance and position

The paper’s experiments use two views centered on the same location. One preserves the local image at its original scale. The other covers a broader region and is downsampled. Concatenating them gives the glimpse network an observation with both fine detail and neighborhood information. The neighborhood can help the controller choose a move, while small features near the center can help the classifier recognize a digit. The full-resolution area processed at a single step stays local even when the complete image is larger.

The visual pathway and the coordinate pathway do different jobs. The visual pathway transforms pixels into features. The coordinate pathway transforms the position into a vector of the same dimension. The network multiplies corresponding entries of these vectors. An appearance response can thus have a different effect depending on where it was observed. This preserves information useful to a recurrent reader that receives patches in a learned order.

```
gₙ = G_image(xₙ | W_image) ⊙ G_loc(lₙ | W_loc)
```

Here `n` indexes the glimpse and `gₙ` is the combined feature vector. The observation at that step is `xₙ`, and its coordinate pair is `lₙ`. The functions `G_image` and `G_loc` encode the pixels and the position, with respective learned weights `W_image` and `W_loc`. The vertical bar in these function calls separates the input from the weights. The symbol `⊙` means that the multiplication happens entry by entry.

The paper uses the same printed symbol for the glimpse observation and one entry of the coordinate tuple. The distinction is easier to follow when the tuple gets its own coordinate names. The coordinates are real valued, with the origin at the center of the input image. A unit of distance in this coordinate system is mapped to a chosen number of pixels.

```
lₙ = (uₙ, vₙ)
```

The tuple `lₙ` gives the center of the crop at step `n`. Its horizontal and vertical coordinates are written here as `uₙ` and `vₙ`. The parentheses group them into a single position. Changing the pixel width of a coordinate unit changes how far a chosen shift moves the crop in the image. It also changes how much image area is explored when locations are sampled with a fixed spread in coordinate units. The authors report sensitivity to that scale and say that around 15% of the input width tends to work well as a general setting.

#### The recurrent layers divide memory from control

The lower layer receives the glimpse vector and its own previous state. The authors use long short-term memory units, or LSTMs, in both recurrent layers. These units give the network a learned way to retain information across steps. That ability matters when the evidence for a label is distributed over several looks or when a location decision depends on an earlier part of the reading.

```
r⁽¹⁾ₙ = R_recur(gₙ, r⁽¹⁾ₙ₋₁ | W_r1)
```

The superscript `⁽¹⁾` identifies the lower layer. Its current state output is `r⁽¹⁾ₙ`, and `r⁽¹⁾ₙ₋₁` is its output at the preceding step. The input `gₙ` describes the current glimpse. The recurrent operation is `R_recur`, and `W_r1` denotes the weights of this layer. The subscript `n−1` refers to the prior step, so the update can use information carried forward from earlier observations.

```
r⁽²⁾ₙ = R_recur(r⁽¹⁾ₙ, r⁽²⁾ₙ₋₁ | W_r2)
```

The superscript `⁽²⁾` identifies the upper layer. The new output `r⁽²⁾ₙ` combines the current lower-layer output `r⁽¹⁾ₙ` and the previous upper-layer output `r⁽²⁾ₙ₋₁`. The function `R_recur` again denotes the recurrent operation, now with the upper layer’s weights `W_r2`. At initialization the upper layer takes its starting information from the coarse view. Its later states also carry information from the detail gathered through the lower layer.

```
c_I = C(I_coarse)
```

In this expression `I_coarse` is the downsampled version of image `I`. The context network is `C`, and `c_I` is its fixed-length output vector. The authors use three convolutional layers to map the coarse image to the representation that initializes the upper recurrent layer. The classifier reads from the lower layer, whose initial vector is set to zero.

The emission network converts the upper state to the proposed coordinates. During training the proposal is used as the center of a sampling distribution. During a deterministic reading it can be taken directly as the next crop center. In both cases the location proposal is a consequence of what the reader has already seen and remembered.

```
l̂ₙ₊₁ = E(r⁽²⁾ₙ | W_e)
```

The hat on `l̂ₙ₊₁` marks a predicted location for the following step, indexed by `n+1`. The function `E` represents the emission network, with weights `W_e`. It takes the current upper-layer output `r⁽²⁾ₙ` as input. The emission network has a fully connected hidden layer and returns a coordinate pair.

```
p(y | I, l, W) = [O(r⁽¹⁾ₙ | W_o)]ᵧ
```

The classifier `O`, with weights `W_o`, maps the lower-layer output `r⁽¹⁾ₙ` to a vector of class probabilities. The subscript `y` outside the brackets selects the entry for class `y`. The notation on the left makes explicit that this particular reading is conditioned on image `I`, the selected path `l`, and the network weights `W`, which include `W_o`. After passing through a fully connected hidden layer, the classifier’s predictions are converted by its softmax output into a probability distribution across the classes. For the single-label case, the paper takes this output at the final step `N`. In sequential recognition, the relevant step is the end of the glimpse allocation for the current label.

#### Why the locations need a separate learning signal

If the correct location of every digit were supplied, choosing a location could be treated as a supervised prediction problem. Here the training answer is a class or a sequence of classes. The locations are latent variables, meaning the network uses them to produce the answer even though their values are unobserved in training. Several paths can support the same correct prediction, and the likelihood assigns credit by taking account of the probability of each path and the probability of the answer along it.

```
log p(y | I, W) = log Σₗ p(l | I, W) p(y | l, I, W)
```

Here `y` is the observed label, `I` the image, and `W` all trainable weights. The lower-case `l` stands for a path of glimpse locations. The term `p(l | I, W)` is its probability under the current location policy, while `p(y | l, I, W)` is the probability assigned to the label after taking that path. The symbol `Σₗ` denotes marginalization over paths in the paper’s summation notation. The function `log` takes the logarithm of the resulting label probability. The sampling procedure itself uses real-valued coordinates.

This expression puts the logarithm outside an average over paths. The paper trains with a lower bound that averages the log probability of the correct class along a path instead. The bound makes it possible to evaluate the quality of paths that the controller samples. A trajectory that puts little probability on the correct label lowers the average, even if the same image also admits a much better trajectory. The training objective thus has a reason to improve the paths the controller actually tends to select.

```
log Σₗ p(l | I, W) p(y | l, I, W) ≥ ℱ = Σₗ p(l | I, W) log p(y | l, I, W)
```

The symbol `ℱ` denotes the variational lower bound. The inequality `≥` says that the marginal log likelihood on the left is at least as large as the bound. The sum on the right weights the log label probability by the path probability. The symbols `l`, `I`, `W`, and `y` again mean the path, image, weights, and target class. In the paper’s derivation, the bound can also be written in terms of a joint probability and the entropy of the location distribution.

```
ℱ = Σₗ p(l | I, W) log p(y, l | I, W) + H[l]
```

Here `p(y, l | I, W)` is the joint probability of the label `y` and the path `l` for image `I` with weights `W`. The term `H[l]` is the entropy of the path distribution, a measure of its uncertainty. Expanding the joint probability into a path probability and a conditional label probability makes the path-log-probability contribution cancel with the entropy term. The conditional log probability remains inside the path average `Σₗ`.

The weights appear both in the class probability and in the probability of taking a particular path. The derivative therefore has two contributions. One improves the classification made from a chosen path. The other changes which paths the controller is likely to choose. The second contribution is essential because even a capable classifier can have little evidence if the crop falls on the background.

```
∂ℱ/∂W = Σₗ [p(l | I, W) ∂log p(y | l, I, W)/∂W + log p(y | l, I, W) ∂p(l | I, W)/∂W]
```

The symbol `∂` denotes partial differentiation, so `∂ℱ/∂W` is the gradient of the lower bound with respect to the weights. The sum runs over `l`, and the image `I` and target `y` are fixed for the example. In the first bracketed term the derivative acts on the classification log probability. In the second it acts on the path probability, with the corresponding log probability of the target as a weight. Rewriting the derivative of a probability in terms of its log gives the form used for sampling.

```
∂ℱ/∂W = Σₗ p(l | I, W) [∂log p(y | l, I, W)/∂W + log p(y | l, I, W) ∂log p(l | I, W)/∂W]
```

The same `p(l | I, W)` now weights both bracketed terms, making the sum an average over the location policy. The first gradient still concerns class prediction for path `l`. The second gradient, `∂log p(l | I, W)/∂W`, describes how the weights change the log probability of that path. Its multiplier is the log probability assigned to the correct label `y`. All probabilities are conditioned on the image `I` and use weights `W`.

#### Sampling turns the derivation into a training rule

Enumerating paths would require evaluating combinations of choices across steps. The authors instead draw locations from a Gaussian distribution centered at the controller’s proposal. A training run follows the sampled locations through the image, and later proposals depend on the state reached after the earlier samples. This use of Monte Carlo sampling replaces an average over all paths with an average over paths that the network actually tries.

```
l̃ₙᵐ ∼ 𝒩(l̂ₙ, Σ)
```

The tilde in `l̃ₙᵐ` marks the location drawn for step `n` on sampled run `m`. The symbol `∼` means it is drawn from the distribution on the right. The Gaussian `𝒩` is centered at `l̂ₙ`, the proposal produced from the current reading history. The parameter `Σ` describes the sampling spread. This `Σ` names the Gaussian spread, while a `Σ` with a summation index in the other equations denotes addition over the indexed terms.

```
∂ℱ/∂W ≈ (1/M) Σₘ₌₁ᴹ [∂log p(y | l̃ᵐ, I, W)/∂W + log p(y | l̃ᵐ, I, W) ∂log p(l̃ᵐ | I, W)/∂W]
```

The complete sampled path is `l̃ᵐ`, assembled from the locations drawn on run `m`. The sum averages over `M` such runs, and `≈` marks the sampling approximation. The quantity being estimated is the gradient of `ℱ` with respect to `W`. The label `y` and image `I` remain fixed across the sampled runs. Within the brackets, one term trains the prediction and the other weights the path gradient by the log probability of the target along that path.

The authors point out a practical difficulty with that weight. When a glimpse misses the object, the correct class may receive a very small probability. Its logarithm can then produce a large update, contributing to high variance across sampled paths. The training rule replaces the log probability in the location term with a bounded reward determined by whether the predicted class is correct. The classification term still uses the probability assigned to the target.

```
R = 1 if y = argmax_z log p(z | l̃ᵐ, I, W), and 0 otherwise
```

The reward `R` takes the value `1` when the chosen class agrees with target `y`, and `0` otherwise. The operation `argmax_z` returns the candidate class `z` with the largest log probability. The probability comes from the reading of image `I` along sampled path `l̃ᵐ` with weights `W`. Two correct classifications receive the same reward for the location update even when their predictive confidence differs.

The network also learns a baseline for the reward. This baseline estimates what reward to expect from the current state. The location update uses the difference between the observed reward and that expectation. A choice that leads to a better outcome than expected receives a positive weight. Subtracting the expectation reduces variability from the general difficulty of a state.

```
bₙ = E_baseline(r⁽²⁾ₙ | W_baseline)
```

The baseline at glimpse step `n` is `bₙ`. The function `E_baseline` predicts it from the upper-layer state `r⁽²⁾ₙ` and has its own weights `W_baseline`. The authors train this predictor by regression toward the expected reward. Its input lets it account for the evidence acquired so far, which can differ substantially between images and between points in a reading.

```
U(W) = (1/M) Σₘ₌₁ᴹ [∂log p(y | l̃ᵐ, I, W)/∂W + λ(R − b) ∂log p(l̃ᵐ | I, W)/∂W]
```

Here `U(W)` denotes the gradient update used in practice. The outer sum averages over the `M` sampled paths indexed by `m`. The first term applies the classification gradient for image `I` and class `y`. The second applies the gradient of the log probability of sampled path `l̃ᵐ`, weighted by the observed reward `R` minus the applicable baseline `b`. The multiplier `λ` balances this contribution against the classification gradient. The baseline is evaluated from the recurrent state at the relevant glimpse.

In reinforcement learning terms, the controller is a policy that chooses where to look, and the centered reward determines how the sampled actions influence that policy. The authors identify the location update as a REINFORCE update for expected reward. The lower-bound derivation explains why a path-probability gradient appears in the first place. The bounded reward then changes the signal used to train that part of the network. The paper describes the practical procedure as motivated by the likelihood bound and identifies the expectation that the reward-based location term estimates.

#### Extending the reader to a sequence

For multiple objects, the training label is an ordered list. The task supplies the order, such as left to right for the forward house-number reader. The network has a fixed glimpse allocation for each target and emits one prediction after using it. Its recurrent states carry forward what it has gathered so far. A special terminal class lets it signal that there are no further digits. During training this class gets its own glimpse allocation, giving the network a supervised target for stopping as well as for reading.

```
log p(y₁, y₂, …, y_S | I, W) = Σₛ₌₁ˢᵘᵖ log Σ_{lₛ} p(lₛ | I, W) p(yₛ | lₛ, I, W)
```

In this expression `y₁, y₂, …, y_S` are the ordered targets, and the upper limit written as `ˢᵘᵖ` denotes `S`, the number of targets included in the sum. The index `s` selects a position in that sequence. The notation `Σ_{lₛ}` denotes marginalization over the glimpse locations associated with target position `s`. The policy assigns them probability `p(lₛ | I, W)`, and `p(yₛ | lₛ, I, W)` gives the probability of the target from those observations. The image is `I`, the weights are `W`, and the recurrent states carry the history across the training sequence. The displayed objective follows the paper’s target-by-target notation.

```
N × (S + 1)
```

This is the training glimpse budget for an image with `S` objects when `N` glimpses are allocated per target. The additional `1` inside the parentheses accounts for the terminal label. The multiplication `×` applies the same glimpse budget to each object and to that last classification.

The sequence also changes the reward. A prediction earlier in the sequence can support a useful reading trajectory into the later positions. The authors count correct predictions up through the current target and accumulate the gradient across targets. They impose one further condition. The first mislabeled target is the end of the part of the sequence that contributes to the gradient for that training run. Later predictions are left out. The practical effect is to emphasize a correct beginning before asking the policy to learn from its progress further along the number.

```
Rₛ = Σⱼ≤ₛ Rⱼ
```

The cumulative reward `Rₛ` is associated with target position `s`. The index `j` ranges over positions up to and including `s`, as indicated by `j≤s`. The contribution `Rⱼ` is the correctness reward for the individual prediction at position `j`. The sum accumulates those contributions, while the gradient restriction determines which parts of the trajectory enter the update.

#### Training and making predictions

The general training procedure uses stochastic gradient descent with Nesterov momentum. Stochastic gradient descent estimates the update from a subset of training examples, while momentum carries information from earlier updates into later ones. The mini-batch contains 128 examples and the momentum coefficient is `0.9`. The appendix gives `0.01` as the initial learning rate and `0.97` as the factor applied after every epoch. The experiments use grid search and validation to choose learning-rate and location-sampling settings.

```
g(x) = max(0, x)
```

Here `g` denotes the rectified linear unit activation used in hidden layers, and `x` is its scalar input. The operation `max` takes the larger of `0` and `x`, passing positive input through and setting negative input to zero. This use of `g` names the activation in the appendix, while `gₙ` in the glimpse equations names an entire feature vector. The authors associate this activation choice with faster training.

At inference, a deterministic reader takes the predicted center directly. The paper also evaluates repeated stochastic readings. Their paths can expose different regions or place a crop differently around a digit, so combining predictions can reduce dependence on a particular selection of locations. The marginal likelihood motivates an average of probabilities. For the practical comparison, the authors found that averaging log probabilities worked best.

```
𝔼ₗ[p(y | I, l)] ≈ (1/M) Σₘ₌₁ᴹ p(y | I, l̃ᵐ)
```

The symbol `𝔼ₗ` denotes the expectation over locations, and `p(y | I, l)` is the class probability conditional on image `I` and path `l`, with the trained weights implicit. On the right, `l̃ᵐ` is the path for sampled run `m`, and the `M` runs are given equal weight by the factor `1/M`. The approximation relates the ideal path average to the quantity that can be estimated by repeated readings. Averaging logs is the separate empirical choice the authors report.

### Experiments and results

#### Digit pairs test whether glimpses work together

The first experiment uses handwritten digits drawn from MNIST. The authors place a pair in a `100x100` image with distracting background noise. The output is one of `55` possible digit combinations. Each image receives a single class label for the pair, and the network has `4` glimpses before it classifies the image. A successful prediction can depend on both digits, so the test exercises the connection between choosing locations and retaining what previous glimpses revealed.

For this experiment the authors deliberately use a simple visual encoder with a single fully connected hidden layer of `256` units. The appendix reports `512` LSTM units and `256` hidden units for the fully connected layers. The Cartesian unit width is set to `20`, and the sampling standard deviation for the glimpse location is `0.03`. With relatively little capacity devoted to the image encoder, the experiment puts emphasis on the controller and recurrent state. The comparison is reported in terms of classification error on the constructed digit-pair task. The deep recurrent attention network with a context network is the strongest setting reported for that task.

The paper’s visual examples complement the class-error comparison. They show successive chosen image regions, giving a reader a way to inspect how the computation proceeded before the pair label was produced. This matters because a class prediction gives only the outcome. A path can reveal that the system sought evidence in more than one part of the image, which is precisely what a test based on dispersed digits was designed to make possible.

#### A sum is a weaker clue about what to look for

The second synthetic task also uses a pair of MNIST digits on a `100x100` image. The background in this experiment is empty and the class label is their sum, with `19` possible targets. That label provides less direct supervision about digit identity. For instance, the paper gives `[5,5]` and `[3,7]` as distinct pairs associated with the same answer. Even when the digit classes are sampled uniformly, the target classes are unevenly distributed, with much of the probability concentrated around `10`.

The same attention architecture achieves a `2.5%` classification error on this constructed digit-addition task. The authors report that the convolutional comparisons learn more slowly and finish with worse performance under the sum labels. The paper also shows example trajectories that alternate between the locations of the digits. These examples make the change in behavior concrete. A system with the same general architecture can acquire a different pattern of looking when supervision changes from naming the combination to naming its sum.

The pair and addition experiments answer different questions. The pair task supplies direct information about the identities associated with the image, while placing the digits amid distractors. Addition supplies a weaker clue about the components but has a blank background. Together they show that the reader can combine local observations under different forms of supervision. The comparison between their trajectories is informative about the range of policies the network can learn, with both the label and the background contributing to the difference between the tasks.

#### Street View turns classification into transcription

The multi-digit Street View House Numbers dataset, or SVHN, comes from images of house fronts. The authors make a validation set of `5000` images by sampling from the training and extra sets. They use this validation data to choose the learning rate and the variance of location sampling. Training uses the remaining `200,000` images. The preprocessing follows the earlier convolutional comparison, first making closely cropped `64 x 64` images centered around their digits. Jittered `54x54` crops are used during training. The authors convert the images to grayscale after observing that color did not affect final classification performance in their setup.

The natural digit order supplies the target sequence for the forward reader. It gets `3` glimpses per digit, and the end symbol gets the same allowance. The paper reports up to `5` digits per SVHN image and therefore a maximum of `18` glimpses, including the terminal prediction. Training the attention network took around `3` days on a GPU. Its visual encoder is larger than the one used in the synthetic tasks, reflecting the variation in photographic backgrounds, lighting, and digit resolution.

The gaze encoder has convolutional kernels of `5x5` in its first layer and `3x3` in the subsequent layers. Its successive filter counts are `64`, `64`, and `128`. Each recurrent layer contains `512` LSTM units, and the fully connected hidden layers in the modules have `1024` rectified units. The coordinate unit is `12` pixels. The appendix describes the location sampling setting for this experiment as a fixed variance of `0.03`. For the implemented dense comparison, all `8` convolutional layers have `128` filters, followed by `2` fully connected layers with `3096` rectified units each. The authors apply `50%` dropout across its `10` layers. Dropout randomly suppresses activations during training to reduce overfitting.

First convolutional layer filter count in the multi-digit SVHN image encoders The local glimpse encoder starts with fewer filters than the full-image convolutional comparison.

**The numbers**

| System or setting | filters |
| --- | --- |
| Full-image ConvNet encoder | 128 |
| DRAM glimpse encoder (this paper) | 64 |

The chart measures the width of the first convolutional layer in each image encoder, with a lower count indicating fewer filters in that layer. The authors’ broader computation comparison concerns estimated floating-point operations and total parameters. It accounts for the fact that the recurrent reader applies its glimpse encoder repeatedly, whereas the convolutional comparison processes the image densely. The authors report lower estimated computation and fewer parameters for the recurrent attention approach.

For recognition, the central metric is whole-sequence error. A transcription fails under this metric if it includes a wrong digit, misses a digit, or ends with an extra one. The paper reports that a single forward reader trails the strongest convolutional benchmark even when the forward predictions are averaged across sampled paths. One recurring problem is that the reader predicts a digit when it should emit the terminal class. Its local classifications can therefore be good enough to produce a plausible number and still yield an incorrect full transcription.

The authors train another reader on the reverse order. The two readers can share glimpse-network weights, while their recurrent and emission weights differ. To combine their predictions, the procedure takes the shorter of the predicted lengths. It takes a prefix of that length from the backward reading and reverses its order to produce the result. This uses both readers to set the cutoff and uses the backward reading for the digits retained by the heuristic. The combined system outperforms the convolutional comparisons on the standard cropped task. The paper also describes trajectories in which the chosen locations follow a number that slopes across the picture.

#### Enlarged crops separate transfer from retraining

The enlarged SVHN task uses `110x110` images made by extending the original bounding region. The construction preserves digit scale as in the `54x54` crops while giving the reader more surrounding area. This is an important experimental choice. It tests a larger search region while keeping the local appearance of the digits suitable for the glimpse encoder that was learned on the small images.

The authors apply the network trained on the smaller crop directly to the enlarged image. They then test a procedure they call focusing. The initial reading produces a sequence of glimpse locations. A `54x54` window around that sequence becomes the input to another reading, which supplies the final answer. This lets the first pass act as a rough localizer and gives the second pass a field of view like the one used in training. The paper reports recognition performance similar to the tight-crop condition when using this procedure without training the reader on the large images.

The authors also compare a fine-tuned attention reader with a convolutional network trained on the enlarged data. The attention reader achieves lower whole-sequence error in that comparison. The paper describes the attention adjustment as taking a few hours and the training of the deep convolutional comparison as taking one week. These times describe the reported training procedures, which start from different conditions. They add context to the transfer result, while the whole-sequence error addresses how well the resulting systems read the enlarged images.

### What the ablations show

#### Context helps choose a place to begin

The digit-pair comparison provides the clearest test of context as part of the controller. The paper reports that the recurrent attention setting with a context network does better than the alternatives on that task. The rest of the reading problem makes this a useful setting in which to observe such an effect. The background is distracting, the digits must be found, and the glimpse network has been kept deliberately simple. A broad view can make the first local observation more productive or give the controller information that it can use on later moves.

The architecture makes the route for that benefit explicit. The classifier takes the lower recurrent state, and the context representation initializes the upper one. The controller uses the upper state to choose a patch whose features then reach the lower state. The comparison supports adding coarse context to this reading setup. Its overall error rate cannot apportion the gain among better first crops, better later moves, and differences in what useful evidence survives in the recurrent state. The authors’ concern about a direct classification shortcut explains the wiring, while the context comparison measures its benefit as part of the whole system.

#### Different tasks produce different paths through the image

The addition and pair visualizations are analyses of learned behavior. In the addition examples the glimpses move back and forth between the digits. The difference is meaningful because the target sum can be supported by local information from both positions even when the label never names the digits individually. The observation makes plausible the authors’ interpretation that the policy has learned to seek evidence from both sources.

The figures provide selected examples of trajectories. They say how a successful reading can unfold and provide no frequency for this behavior across the data. The tasks also change both the background and the target. The contrast therefore cannot isolate the effect of the sum label on gaze on its own. A further distinction concerns the calculation performed inside the reader. Predicting the sum class and visibly attending to both digits is consistent with combining their identities, while the reported test measures the resulting classification instead of the intermediate calculation.

#### More readings help less than changing how a reading ends

The paper evaluates repeated sampling for single-direction reading and then a combination of forward and backward readers. The former gives the prediction access to evidence from several sampled paths. Even with that procedure, the forward-only reader remains behind the strongest convolutional comparison. This locates a limit of averaging within the same reading direction. A persistent error at the terminal decision can survive a change in which patches are sampled.

The combined reader changes both the direction in which evidence is acquired and the rule for selecting the output. The two directions encounter opposite ends of the number first. Taking the shorter predicted length specifically addresses overprediction, while drawing the retained digits from the backward prefix changes which classifications decide the transcription. The observed improvement belongs to the combined procedure. The comparison supplies no independent estimate of how much comes from backward training, the length rule, or the interaction between them. The paper invokes the distribution of leading digits as part of the motivation for exploring the second direction, while the strongest empirical finding is the performance of the resulting combination.

The large-image experiments make a different distinction. Direct application asks how far the trained small-crop reader transfers on its own. Focusing adds a second inference pass using a crop chosen from the first pass. Fine-tuning changes weights using the enlarged data. The favorable result from focusing shows that the initial gaze sequence can supply a useful spatial estimate, even when a direct reading could benefit from further work. Fine-tuning answers a separate question about adapting an already trained reader to the larger field of view.

#### The regularization comparisons are specific to the training setup

On multi-digit SVHN, the authors report a `0.1%` performance improvement from adding dropout to the attention network. For the deep convolutional comparison, restricting dropout to the last two fully connected hidden layers gives a whole-sequence error rate of `5.5%`. The first number is the change reported for the recurrent reader, while the second is an error level for a particular convolutional configuration. Together they support the authors’ observation that the convolutional system depended more strongly on its regularization choices in these experiments.

The authors propose that stochastic glimpse selection may itself help limit overfitting. Training on sampled crops gives the network some variation in the observations it receives for a particular image. The dropout results are compatible with that account. They do not measure the effect of sampling in isolation, since the two architectures differ in what they process and in how they make predictions. Likewise, the authors describe truncating training after the first wrong target as crucial for sequence recognition, while the paper presents it as a training choice instead of giving a separate numerical comparison that isolates it.

### Limitations

#### Boundaries identified by the authors

The input coordinate scale is a sensitive setting. A move in the controller’s coordinates has to correspond to a useful distance in pixels. With a small effective move, consecutive crops may reveal little new information. With a large move, exploratory samples may fall away from the object. The paper gives a setting that tends to work and different configurations for the synthetic and Street View tasks. Choosing the scale is therefore part of applying the approach to a particular image distribution.

The authors also identify a stopping problem in the forward reader. It can continue to emit digits after exhausting the sequence. Their strongest standard SVHN result addresses this with a second direction and a heuristic based on the shorter reading. The solution is tied to a task where the target can be read in opposite orders and where an overlong prediction is common enough to motivate truncation. For a task with frequent early stopping, the same choice of the shorter length could discard useful predictions. The reported SVHN result establishes the merit of the heuristic in that setup.

Several parts of the training procedure respond to a difficult search problem. Sampling makes path evaluation tractable. A bounded reward and state-dependent baseline help control variance. A training run contributes only through its first mislabeled sequence target. The authors present these choices as important to making end-to-end learning work. The likelihood derivation explains the form of the location update, while the actual procedure uses a classification signal and a reward signal with distinct objectives. Its accuracy is an experimental result of that procedure.

#### Boundaries visible in the experiments

The multi-object tasks are closely related. They cover pairs of handwritten digits, sums of handwritten digits, and ordered strings of photographed digits. Each has a known target vocabulary and a clear convention for what output to expect. Even in the addition task, a correct answer belongs to a defined set of sum classes. The experiments establish learned coordination of attention and recognition for these problems. Their scope leaves open how the same approach would work for a scene with unknown object categories, several unrelated groups of objects, or no obvious order in which to describe them.

The supervision claim concerns label-only learning of the glimpse choices. The real-image pipeline itself uses crops derived from house-number regions, and the enlarged task extends those regions while preserving digit scale. The network learns where to look inside these inputs without digit-location targets for its policy. A search of full house-front imagery with unrestricted position and scale would be a broader test. The paper’s glimpse visualizations give evidence about learned localization within its images, while whole-sequence error scores the transcription. It does not score the geometry of the selected locations against a localization target.

Efficiency also has several parts. A fixed-size glimpse bounds the detailed visual work done at one step. Overall work depends on how many steps the reader uses, how many times it is run on an image, and how much coarse processing it does. The authors calculate the recurrent cost at the maximum sequence length and observe that numbers are commonly around `2-3` digits long. A backward reading, sampling-based averaging, or focusing can add passes. The paper’s floating-point operation estimates and parameter comparison address important aspects of cost, while the reported training times describe particular runs and the enlarged-image adaptation procedure.

Finally, the terminal class allows a variable number of output labels within the experimental procedure, and the authors propose that a reader can be adapted to longer sequences. In SVHN there is also a dataset-based length limit. Growth beyond the tested lengths would put more demands on maintaining state, allocating glimpses, and learning reliable stopping. The mechanism gives the architecture a way to express different lengths. The evidence for accuracy comes from the particular sequence ranges and cropping conditions that the experiments use.

### What came after

#### Attention for describing and generating images

The later citing works span several kinds of visual and sequential decisions. The closest connection in task is [Show, Attend and Tell: Neural Image Caption Generation with Visual Attention](https://md.research.elamur.ai/free/en/papers/xu-2015-show-attend-tell-neural-image/). It uses visual attention in image caption generation. The connection is the relationship between spatial evidence and a sequence of outputs. In the house-number task, the requested output follows the order of visible digits. A caption uses words to describe picture content, so the relationship between a region and the next output is a language decision as well as a visual one. This carries the question of what to attend to from transcription into description.

[Image-to-Markup Generation with Coarse-to-Fine Attention](https://md.research.elamur.ai/free/en/papers/deng-2016-image-markup-generation-coarse-fine/) also turns an image into a structured sequence. Its stated attention scheme provides a close point of comparison with the separation between broad context and local detail in the house-number reader. Both tasks need visual information organized around the output being produced. Markup makes the output a representation of structure, while the house-number experiment uses a digit order supplied by the task. The later title identifies coarse-to-fine attention as its approach to image-to-markup generation, placing the choice of visual scale inside the sequence task.

[DRAW: A Recurrent Neural Network For Image Generation](https://md.research.elamur.ai/free/en/papers/gregor-2015-draw-recurrent-neural-network-image/) places recurrence on the image-generation side. In the attention reader, successive observations are accumulated so that the system can emit labels. In an image-generation task, recurrence organizes the production of a visual result over steps. The shared question is how a visual task can be decomposed over time. The difference in output explains why the relationship to the earlier paper is broader than another application of its digit-recognition procedure.

The image-to-text connection also appears in [On the Automatic Generation of Medical Imaging Reports](https://md.research.elamur.ai/free/en/papers/jing-2018-automatic-generation-medical-imaging-reports/). Its stated task connects image information to a report, adding a domain and an output form quite different from a short ordered transcription. The citation places the work in contact with the visual attention literature. The task description establishes the purpose of the later system, while leaving the particular role of recurrent glimpses in its design unspecified.

#### Choosing locations, training decisions, and combining evidence

[Spatial Transformer Networks](https://md.research.elamur.ai/free/en/papers/jaderberg-2015-spatial-transformer-networks/) addresses spatial transformation inside a network. It is related to the house-number reader at the level of deciding how an image is presented to later computation. In the earlier paper, that decision takes the form of choosing crop centers and iterating through them. A work organized around spatial transformation frames the intervention more generally as changing the spatial representation. The citation supports the connection between these problems without making the earlier Gaussian location policy part of the description of the later method.

[Sequence Level Training with Recurrent Neural Networks](https://md.research.elamur.ai/free/en/papers/ranzato-2015-sequence-level-training-recurrent-neural/) places the emphasis on training an output sequence. The relevance to the attention reader is the gap between a correct decision at one step and a successful complete output. The house-number experiments make that gap visible when a reader classifies digits successfully but emits an extra digit at the end. Its training procedure uses rewards and restricts the gradient after a mistake, while its principal transcription metric evaluates the whole sequence. The later work’s stated subject takes sequence-level training itself as the problem.

[Reinforcement Learning Neural Turing Machines - Revised](https://md.research.elamur.ai/free/en/papers/zaremba-2015-reinforcement-learning-neural-turing-machines/) connects through the decision-making side of the earlier paper. The visual reader has recurrent state and learns a policy whose choices determine the evidence available for later predictions. The later work’s title places reinforcement learning in a different recurrent computational setting, organized around a neural Turing machine. The citation connects these uses of learned decisions over time. The stated subject gives no basis for assuming that its decisions, observations, or rewards match the digit reader’s.

[ABCNN: Attention-Based Convolutional Neural Network for Modeling Sentence Pairs](https://md.research.elamur.ai/free/en/papers/yin-2016-abcnn-attention-based-convolutional-neural/) moves attention to paired linguistic inputs. The house-number reader assigns detailed computation to selected spatial regions. The sentence-pair work names attention as part of convolutional processing for a relation between texts. Their connection illustrates how the term covers different choices about which input information matters for a prediction. A crop controller, a stopping label, and an output order based on image coordinates are specific to the earlier task.

[Neural-Symbolic VQA: Disentangling Reasoning from Vision and Language Understanding](https://md.research.elamur.ai/free/en/papers/yi-2018-neural-symbolic-vqa-disentangling-reasoning/) relates through the distinction between acquiring visual evidence and using it for an answer. In the house-number paper, the upper recurrent layer controls the gaze and the lower one supports classification. The later visual question-answering work puts the separation at a different boundary, between reasoning and the understanding of the visual and linguistic inputs. The two task descriptions support that comparison without implying that the later work inherits the earlier division into recurrent layers.

The remaining citing works show the breadth of the citation record. Playing FPS Games with Deep Reinforcement Learning concerns learned sequential decisions in a game rather than spatial selection for a transcription. [Importance Weighted Autoencoders](https://md.research.elamur.ai/free/en/papers/burda-2015-importance-weighted-autoencoders/) concerns an importance-weighted autoencoding objective, which makes the earlier paper’s use of sampled latent paths a relevant point of comparison at the level of probabilistic training. [TensorFlow: Large-Scale Machine Learning on Heterogeneous Distributed Systems](https://md.research.elamur.ai/free/en/papers/abadi-2016-tensorflow-large-scale-machine-learning/) concerns the execution of machine learning computations at scale. Its relation to the paper’s motivation is computational, while its stated contribution is a system for running such computations. These citations place the paper alongside work on visual generation, sequence learning, and computation. The clearest task-level continuations are the later approaches that explicitly use attention to turn an image into a sequence.

## Cite

Cite as Jimmy Lei Ba, Volodymyr Mnih and Koray Kavukcuoglu. 2014. Multiple Object Recognition with Visual Attention. arXiv (Cornell University).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.1412.7755](https://doi.org/10.48550/arxiv.1412.7755) · [arXiv 1412.7755](https://arxiv.org/abs/1412.7755)

```bibtex
@misc{ba2014multiple,
  title = {{Multiple Object Recognition with Visual Attention}},
  author = {Jimmy Lei Ba, Volodymyr Mnih and Koray Kavukcuoglu},
  year = {2014},
  doi = {10.48550/arxiv.1412.7755},
  eprint = {1412.7755},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.1412.7755}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
