Phrase-based Image Captioning

Rémi Lebret, Pedro H. O. Pinheiro, Ronan Collobert

Generating a novel textual description of an image is an interesting problem that connects computer vision and natural language processing. While most modern image captioning models rely on complex Recurrent Neural Networks (RNNs) to generate sentences word-by-word, this paper proposes a surprisingly simple alternative. By predicting a set of phrases (noun, verb, and prepositional) and assembling them using a constrained language model, the authors achieve results competitive with state-of-the-art deep learning models while maintaining significantly better descriptive diversity.

The Challenge of Image Captioning

Generating a natural language description for an image requires a bridge between identifying objects (computer vision) and expressing their interactions (natural language processing). At the time of this research, the dominant trend was using "Encoder-Decoder" architectures—specifically, using a Convolutional Neural Network (CNN) to "see" the image and an RNN (like an LSTM) to "write" the caption.

However, these RNN-based models are often overly complex and prone to overfitting. In fact, some state-of-the-art models were found to simply "memorize" the training set, regurgitating exact training sentences up to 80% of the time. This paper investigates whether accurate, novel captions can be generated using a much simpler, phrase-based approach that respects the inherent syntactic structure of image descriptions.

Methodology

The authors' approach breaks the captioning process down into three main stages: phrase prediction, sentence generation, and sentence re-ranking.

1. Phrase Prediction (The Bilinear Model)

The first step is to extract relevant phrases from the image without worrying about sentence structure.

  • Image Features: A pre-trained VGG CNN extracts a 4096-dimensional vector representing the image.
  • Phrase Features: Phrases (e.g., "a man," "is riding," "on a skateboard") are represented by averaging the word vectors of the words within them.
  • The Mapping: A bilinear model is trained to learn a common embedding space. This allows the model to calculate a "match score" between a specific image and a specific phrase. Negative sampling is used during training to teach the model to distinguish between relevant and irrelevant phrases.
The Bilinear Model architecture mapping image features to phrase predictions.

2. Sentence Generation (The Constrained Language Model)

Instead of free-form generation, the system uses a trigram language model constrained by "chunking tags." By analyzing datasets, the authors found that captions follow highly predictable patterns (e.g., a Noun Phrase is almost always followed by a Verb or Prepositional Phrase).

Example of an image description parsed into syntactic chunks (NP, VP, PP).

The model uses beam search to find the most likely sequences of predicted phrases that fit these syntactic "templates," assembling the raw phrases into grammatically valid candidate sentences.

3. Sentence Re-ranking

The language model generates several candidate sentences. To select the best one, the system averages the image-phrase match scores for all phrases in the sentence. The sentence with the highest average score—meaning it best fits the visual evidence—is chosen as the final caption.

Key Insights

  • Syntax is Simpler than we Think: Exploratory analysis revealed that image descriptions have very low syntactic variability. Most are just collections of NP, VP, and PP "chunks." Leveraging this structure is more efficient than forcing an RNN to learn grammar from scratch.
  • Generalization over Memorization: Unlike RNN models that often repeat training sentences, only 1% of the captions generated by this model for the Flickr30k dataset were present in the training set. This suggests the phrase-based approach is much better at "composing" new descriptions from known parts.
  • Visual Fine-Tuning Matters: Word vectors trained on text-only corpora (like Wikipedia) are not perfectly suited for images. Fine-tuning the phrase embeddings using the image data significantly boosted performance, aligning semantic meaning with visual features.

Results and Limitations

The model was evaluated on two industry-standard benchmarks: Flickr30k and Microsoft COCO. Despite its simplicity, the phrase-based model held its own against much more complex architectures. On the COCO dataset, it achieved a BLEU-4 score of 0.23, comparable to the state-of-the-art at the time, while remaining computationally efficient to train and use for inference.

However, the approach does have limitations. Because the language model is a simple trigram model, it can occasionally make "common sense" errors that a more sophisticated model might avoid. Furthermore, the initial sentence generation phase is only conditioned on the set of predicted phrases, not the image itself; the image only comes back into play during the final re-ranking. Future work could incorporate more complex language models while keeping the highly generalizable phrase-based core intact.

Summary updated

BibTeX
@inproceedings{lebret2015phrase,
  author = {Rémi Lebret and Pedro H. O. Pinheiro and Ronan Collobert},
  title = {{Phrase-based Image Captioning}},
  booktitle = {International Conference on Machine Learning},
  year = {2015},
  url = {https://openreview.net/forum?id=B1bmDhZubB},
}
Figure