TL;DR
Vinyals, Toshev, Bengio and Erhan built one neural network that looks at a picture and writes a sentence about it. A convolutional network turns the image into a fixed list of numbers, and a recurrent LSTM network, started from those numbers, writes the words one at a time. The whole system is trained end to end to maximise the probability of the correct caption. On several benchmarks it scored higher than the systems that came before it.
Builds on: Convolutional Neural Network, Long Short-Term Memory, Word Embedding, Encoder-Decoder Architecture · Leads to: Image Captioning
Why it mattered
Before this work, captioning systems were built from separate parts: a detector found objects, a rule set arranged them, and a template produced the sentence. The paper showed that a single trained model could replace that pipeline and do better on the standard scores. On the Pascal dataset its BLEU-1 score was 59, against a previous best of 25 and a human figure of 69. On Flickr30k it reached 66 against 56, and on SBU it reached 28 against 19. The design, a CNN encoder followed by a language-model decoder that starts from the image, is the pattern that later captioning work built on.
The problem
Describing an image needs three things at once: recognising the objects, working out how they relate and what they are doing, and writing that in fluent English. Hand-built systems handled each step with a separate rule, so they were brittle outside their domains. Retrieval systems, which pick an existing caption from a database, could not write a new sentence for a new combination of objects. The authors wanted a model that generates sentences, and that can be trained from image and caption pairs alone.
How it works
The pipeline runs in one direction: image in, words out.
- Encode the image. A CNN pretrained on ImageNet classification reads the image and produces a fixed-length vector. The paper feeds this vector into the decoder once, at the first step. Check: the image is a single vector, not a sequence, so the decoder receives one fixed-size summary of it.
- Start the decoder. A special start token is fed in next, and the LSTM, having seen the image vector, produces a probability for every word in the dictionary. Check: the probabilities sum to 1.
- Pick or score the next word. Using the ground-truth caption during training, the true next word is the target. At inference, the model chooses among the likely words. Check: the target is one specific word, so the loss looks only at that word's probability.
- Feed the word back in. The chosen word is turned into an embedding vector and fed to the LSTM at the next step. Check: the embedding's size does not depend on the dictionary size.
- Repeat until the stop token. The LSTM keeps going until it emits a stop token, which marks a complete sentence. Check: a caption of 8 words takes about 9 steps including the stop.
- Search for the best sentence. At inference, the model keeps the 20 best partial sentences at each step (a beam of size 20) and returns the best complete one. Check: using a beam of size 1, which is greedy search, lowered the paper's scores by about 2 BLEU points on average.
flowchart LR I[Image] --> C[CNN encoder] C --> V[Image vector] V --> L1[LSTM step -1] S0[START] --> L2[LSTM step 0] L1 --> L2 L2 --> P1[Word probabilities] P1 --> W1[Chosen word] W1 --> L3[LSTM step 1] L3 --> P2[More probabilities] P2 --> E[STOP ends caption]
A tiny example traced by hand. Use toy numbers, not the paper's. Suppose the true caption is "a dog" followed by stop, and the LSTM gives these probabilities for the true words: 0.6 for "a" at the first step, 0.5 for "dog" at the second, and 0.9 for stop at the third. The loss adds the negative logs: . Training pushes all three probabilities up, which lowers this number.
Training choices that mattered. The authors trained every weight with stochastic gradient descent at a fixed learning rate and no momentum. The image CNN started from ImageNet weights and was left unchanged, because updating it hurt results. Word embeddings started random, since initialising them from a news corpus gave no clear gain. The vocabulary kept only words that appeared at least five times in the training captions. Overfitting was the main difficulty, since the caption datasets are small, so dropout and averaging several models together added a few BLEU points, and the paper reports its numbers with both in place.
The math
The training objective maximises the probability of the correct caption for each training image , summed over the training set, with parameters :
Step 2 in symbols: the chain rule over words
Because a caption has no fixed length, the paper factors its probability word by word:
Here is the start token and is the stop token, and is the length of this caption.
Step 3 in symbols: the recurrent state
The recurrent state summarises everything seen so far and is updated by a function :
The paper chooses to be an LSTM, whose state is the output and whose memory is a cell . It has an input gate , a forget gate (not the function ) and an output gate . Writing for the sigmoid and for elementwise product:
The word distribution is a softmax over . The gates let the cell keep or drop information, which is what makes long sentences trainable.
Step 1 and 4 in symbols: the inputs
The image enters once, as
and each word enters through a learned embedding of its one-hot vector :
Step 5 in symbols: the loss
The loss is the negative log likelihood of the correct word at each step, summed over the caption:
This is the cross-entropy loss between the predicted distribution and the correct word, summed over steps. Minimising is the same as maximising the caption's probability.
Results
The paper reports BLEU, the standard overlap score for machine translation, along with METEOR and CIDEr, and it also runs human ratings. The main numbers, all from the paper:
- MSCOCO development set: BLEU-4 of 27.7, METEOR 23.7, CIDEr 85.5. A nearest-neighbour baseline scored BLEU-4 9.9 and the human caption comparison scored 21.7 on the same measure.
- Official COCO test set: BLEU-4 of 27.2.
- Pascal (BLEU-1, transfer from COCO): 59, against a previous best of 25 and a human score of 69.
- Flickr30k: 66, against 56. Flickr8k: 63, against 58. SBU: 28, against 19.
- Human ratings on a 1 to 4 scale (Flickr8k): NIC averaged 2.37, a reference system 2.08, and the human ground-truth captions 3.89.
What the numbers mean. BLEU rewards word overlap, so a fluent but different caption scores low. The human ratings show the gap: the model is clearly better than the reference system, but well below the human captions. The authors say so directly, and they argue that better metrics are needed.
Limits. Transfer across datasets costs a lot. A model trained on COCO and tested on SBU fell from 28 to 16 BLEU-1. Transfer from Flickr30k to Pascal gave 53 against 59 from COCO. Most of the time the top candidate was a sentence already in the training set (about 80 percent), which suggests the model learned to reuse exemplar captions for the small training sets used. The paper reports that about half of the top 15 candidates were novel sentences with similar BLEU.
Reading guide
Read the paper in this order, with the lessons it needs:
- Abstract and Section 1 (Introduction): the joint model idea, and why it follows machine translation. Needs Encoder-Decoder Architecture.
- Section 2 (Related Work): the older pipeline systems and retrieval approaches. Useful context only; no new prerequisite.
- Section 3 (Model), the equations: maximising the caption likelihood and the chain rule. Needs Maximum Likelihood Estimation and Language Model.
- Section 3.1 (the LSTM): the gate equations. Needs Long Short-Term Memory, and Vanishing Gradient Problem for why gates help.
- Section 3 (Training and Inference): the unrolled model and the loss, then sampling and beam search. Needs Word Embedding, Cross-Entropy Loss and Beam Search.
- Section 4 (Experiments): the metrics and datasets. Needs BLEU Score. Read the results tables after the metric section.
- Section 5 (Conclusion): the authors' summary of NIC and their closing view on evaluation.
Check yourself
QuestionRecall: what does the CNN contribute, and at which step of the LSTM does the image enter?Show answer
The CNN turns the image into a fixed-length vector. The paper feeds that vector into the LSTM once, at the first step, before any word, so the decoder knows the image content from the start.
QuestionToy numbers: the true caption's word probabilities are 0.5, 0.8 and 0.4 at three steps. What is the loss ?Show answer
. Training lowers this value by raising each probability.
QuestionWhy did the authors find that feeding the image at every step gave worse results?Show answer
They report that feeding the image at each time step yields inferior results because the network can exploit noise in the image and overfits more easily. Showing it once, at the start, worked better.
QuestionWhy do the BLEU scores and the human ratings disagree about how close the model is to people?Show answer
BLEU measures word overlap with reference captions, so a fluent caption with different wording scores low. Human ratings judge whether the description is correct and useful, and they show NIC well below the human captions, so BLEU does not fully capture the gap.
Sources
- Vinyals, O., Toshev, A., Bengio, S. and Erhan, D. (2014). Show and Tell: A Neural Image Caption Generator. arXiv:1411.4555
- DOI 10.48550/arXiv.1411.4555