Computer Vision · Advanced level

Advanced level · Module 6: Image Captioning and Visual Understanding · Lesson 1 of 3

How Image Captioning Works

Learners study the encoder-decoder approach: a CNN encodes the image, a recurrent decoder (LSTM) generates words, and attention lets each word look at relevant regions.

In this lesson you will

  • Explain the encoder-decoder captioning approach
  • Explain attention over image regions

Key concepts

image encoderlanguage decoder (RNN/LSTM)word embeddingsattention over regionsbeam search

The lesson

Early neural captioning systems such as 'Show and Tell' used a CNN to encode the image into a vector and an LSTM to generate a sentence word by word. Adding attention lets the decoder focus on different image regions for different words.

Generation uses greedy decoding or beam search, as in other sequence-to-sequence tasks. Captions are trained on large datasets of images paired with human-written descriptions.

Recurrent decoders are now largely replaced by transformers, but the encoder-decoder idea remains. Learners who want more depth on RNNs and sequence models can take the NLP or Deep Learning programmes.

Step by step

  1. Read the 'Show and Tell' abstract and draw its architecture.
  2. Trace how a three-word caption is generated step by step.
  3. Mark where attention would help.
  4. Compare greedy decoding with beam search on paper.

Practice activity

Draw and explain an attention-based captioning architecture.

Expected result: A correct, annotated diagram and step-by-step explanation.

Check your understanding

  1. What does the encoder do in captioning?

    Show answer

    It turns the image into features for the language decoder.

  2. How does attention improve captioning?

    Show answer

    Each generated word can focus on the relevant image regions.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.