Introduction
Traditional image captioning systems have reached high levels of performance by identifying visual objects and their interactions. However, a significant subset of real-world images contains "scene text"—signs, labels, logos, and documents—that provides essential context for a complete description. OCR-based image captioning aims to bridge this gap by integrating optical character recognition (OCR) tokens into the generated captions.
The primary challenge in this field is reasoning. Existing models often treat detected OCR tokens as isolated entities, lacking a deep understanding of their physical arrangement. This frequently leads to captions where text is out of order or semantic connections are missed (e.g., describing a "Federal Express" van as "a van with the words express federal"). This paper introduces LSTM-R, a novel architecture that explicitly models the spatial and geometrical relationships between pieces of scene text to produce more coherent and accurate captions.
The LSTM-R Architecture
The authors propose the LSTM-R (Long Short-Term Memory plus Relation-aware pointer network) architecture. The system is designed to move beyond simple visual features by incorporating the layout of text within the image.
As shown in the architecture diagram, the model consists of three main components:
- Feature Embedding: Extracts visual features from object regions and semantic features from OCR regions.
- Geometrical Relationship Construction: This module calculates a "relation vector" for every pair of OCR tokens, encoding their physical proximity and layout.
- OCR-based Image Captioner: An LSTM-based generator that utilizes a relation-aware pointer network to select the most appropriate words from the image.
Geometrical Relationship Modeling
The core innovation lies in how the model understands the layout of text. Instead of relying solely on word meanings, the model calculates a multi-dimensional relation vector between every pair of OCR tokens based on:
- Size: Differences in height and width between bounding boxes.
- Distance: The shortest Euclidean distance between the boxes.
- Intersection over Union (IoU): The degree of overlap between tokens.
- Orientation: The relative angle between tokens, categorized into eight 45-degree classes.
By encoding these features, the model learns "reading orders" and grouping behaviors. For instance, it can recognize that two words on the same horizontal line with small spacing likely belong to the same phrase.
Refined Training Strategies
To further improve performance, the authors implemented two specific training refinements:
- Word Encoding: A heuristic method that prioritizes OCR representations over a fixed common vocabulary. This helps the model handle the "long-tail" problem where OCR tokens are often rare words not found in standard training sets.
- Multi-label Sigmoid Loss: Traditional models use Softmax, which can struggle when an image contains multiple identical text tokens (e.g., the word "ROOT" appearing on multiple bottles). This loss function allows the model to treat all instances of the same word as valid targets, leading to more stable convergence.
Key Insights and Results
The inclusion of geometrical relationships allows the pointer network to be "relation-aware." While a standard pointer net might pick words based on visual attention alone, the relation-aware version uses the geometrical vectors to guide the selection process, ensuring the model understands which word should naturally follow another based on the physical layout.
The LSTM-R model set a new benchmark on the TextCaps dataset, which contains over 142,000 human-annotated captions. Key results include:
- CIDEr-D Score: An increase from the previous state-of-the-art (MMA-SR) of 98.0% to 109.3% on the validation set.
- Online Test Server: Achieved a CIDEr-D of 100.8%, significantly outperforming the previous best of 88.0%.
- Qualitative Improvement: As seen in the example of the white van, the model is much better at reading text in the correct order and including relevant prepositions compared to models without geometrical reasoning.
Conclusion
By explicitly incorporating the geometrical relationships between OCR tokens, the LSTM-R model demonstrates that spatial context is a powerful proxy for semantic context in scene text. While a gap still exists between AI and human performance (125.5% CIDEr-D), this work provides a robust framework for more intelligent, context-aware image description. Future improvements may involve tighter integration between OCR detection and caption generation to mitigate errors caused by misread characters.
Summary updated