Convolutional Image Captioning

Jyoti Aneja, Aditya Deshpande, Alexander G. Schwing

Abstract

Image captioning is an important task, applicable to virtual assistants, editing tools, image indexing, and support of the disabled. In recent years significant progress has been made in image captioning, using Recurrent Neural Networks powered by long-short term-memory (LSTM) units. Despite mitigating the vanishing gradient problem, and despite their compelling ability to memorize dependencies, LSTM units are complex and inherently sequential across time. To address this issue, recent work has shown benefits of convolutional networks for machine translation and conditional image generation. Inspired by their success, in this paper, we develop a convolutional image captioning technique. We demonstrate its efficacy on the challenging MSCOCO dataset and demonstrate performance on par with the LSTM baseline, while having a faster training time per number of parameters. We also perform a detailed analysis, providing compelling reasons in favor of convolutional language generation approaches.

Introduction

Image captioning, the task of generating natural language descriptions for visual content, has traditionally been dominated by encoder-decoder frameworks using Recurrent Neural Networks (RNNs), specifically Long Short-Term Memory (LSTM) units. While LSTMs are effective at capturing temporal dependencies, they suffer from a sequential bottleneck that hinders parallelization during training and can lead to vanishing gradient issues over long sequences.

This paper challenges this paradigm by introducing a fully convolutional architecture for image captioning. By leveraging the parallel processing capabilities of Convolutional Neural Networks (CNNs), the proposed model matches the performance of state-of-the-art LSTMs while offering significantly faster training per parameter and generating more diverse, descriptive captions.

Methodology

The proposed Convolutional Image Captioning model consists of four primary components designed to replace recurrence with parallelizable operations:

  1. Input Embedding: Words are converted into 512-dimensional vectors.
  2. Image Embedding: High-level visual features are extracted using a pre-trained backbone (e.g., VGG16 or ResNet) and projected into the same 512-dimensional space.
  3. Convolutional Module: The core of the model utilizes layers of Masked Convolutions. The mask ensures causality: when predicting the $i$-th word, the model only has access to words $1$ through $i-1$. Gated Linear Units (GLU) are employed as activation functions to regulate the flow of information.
  4. Attention Mechanism: A spatial attention layer allows the model to dynamically focus on specific $7 \times 7$ regions of the image feature map when generating each word.
The detailed architecture of the Convolutional Image Captioning model, illustrating the integration of masked convolutions, Gated Linear Units (GLU), and the spatial attention mechanism.

Unlike traditional RNNs, this architecture is entirely feed-forward during training, allowing for the simultaneous computation of loss for every word in a caption.

Key Insights and Ideas

The shift to a convolutional framework yields several technical advantages:

  • Parallelism: The non-sequential nature of CNNs allows for massive parallelization during training, avoiding the slow "unrolling" process required by LSTMs.
  • Gradient Stability: Empirical analysis shows that gradients in the CNN decay much more slowly (by a factor of 10x compared to 100x in LSTMs), leading to more stable and efficient training.
  • Diversity and Expressiveness: The CNN produces a higher entropy probability distribution than LSTMs. This allows the model to be more expressive, producing a wider variety of unique n-grams and more natural-sounding phrases.
  • Visual Grounding: The attention mechanism successfully identifies relevant objects. For instance, when generating the word "broccoli," the model's attention maps accurately highlight the corresponding regions in the input image.

Experimental Results

The model was evaluated on the MSCOCO dataset using the standard Karpathy splits.

  • Performance: The CNN-based model achieved a CIDEr score of 0.912, performing on par with the standard LSTM baseline and outperforming previous attention-based LSTM models.
  • Efficiency: The model demonstrates superior training speed per parameter due to its parallel nature.
  • Qualitative Analysis: The CNN often captures nuances that LSTMs overlook. For example, it more accurately identifies specific details such as the "black and white" nature of a photograph.
A qualitative example demonstrating the model's ability to capture specific image attributes, such as identifying a black and white photograph.

Conclusion

This work demonstrates that recurrence is not a requirement for high-quality image captioning. A fully convolutional approach offers a compelling alternative to LSTMs, providing comparable accuracy with improved training efficiency and caption diversity. Future work includes exploring more advanced image encoders and incorporating explicit object attributes to further refine language generation. While inference remains sequential, the training advantages and qualitative gains make convolutional models a strong candidate for future research in vision-and-language tasks.

Summary updated

BibTeX
@inproceedings{aneja2018convolutional,
  author = {Jyoti Aneja and Aditya Deshpande and Alexander G. Schwing},
  title = {{Convolutional Image Captioning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  url = {https://openreview.net/forum?id=rJ-MuRbOZH},
}
Figure