Abstract
Image captioning is a cross-modal task that combines computer vision and natural language processing to generate natural language descriptions of visual content. Recent advances have explored the integration of both grid-based and region-based visual features to better capture relational and contextual information, such as interactions between objects and their surrounding environment. However, combining multiple types of features often results in spatial misalignment, which hinders the model's ability to construct coherent visual-semantic relationships. To address these limitations, we propose a novel Spatial Alignment Positional Encoder (SAPE), which encodes spatial information across aligned grid-level and region-level features to construct a unified visual-spatial representation. In addition, we introduce two complementary enhancement modules: Group Normalization Multi-head Attention (GNMA) to capture global relational cues, and Convolution-based Feature Enhancement Attention (CFEA) to enrich local spatial details. To mitigate the degradation of positional signals during deep training, we further propose a Learnable Adaptive Positional Encoder (LAPE) that dynamically preserves position-sensitive information. These components are integrated into a unified transformer-based architecture named the Visual-Spatial Relationship Sensitive Transformer (VRST). Extensive experiments on the MSCOCO dataset demonstrate the effectiveness of our approach, achieving a CIDEr score of 141.9 on the Karpathy test split and 138.2 on the official evaluation server, surpassing several strong baselines.
Introduction
The task of image captioning requires a sophisticated understanding of both global context and local object details. Modern approaches typically leverage two types of visual features: grid-based features, which provide a uniform spatial representation of the background, and region-based features, which focus on specific objects identified by bounding boxes. However, a significant challenge arises from "spatial misalignment." When these disparate feature types are combined, models often struggle to maintain the correct 3D spatial relationships between objects and their environment. Furthermore, as neural networks increase in depth, the positional signals—crucial for spatial reasoning—tend to decay, leading to descriptions that may identify the correct objects but fail to accurately describe their spatial context (e.g., misidentifying "parked" as "sitting").
Methodology
To address these issues, we introduce the Visual-Spatial Relationship Sensitive Transformer (VRST). The architecture is built upon four primary innovations designed to enhance spatial alignment and preserve positional information.
- Spatial Alignment Positional Encoder (SAPE): SAPE projects grid and region features into a shared, high-dimensional embedding space (4096 dimensions). This alignment ensures that global background information and local object details are represented in a consistent format before downstream processing.
- Learnable Adaptive Positional Encoder (LAPE): Unlike traditional transformers that inject positional data only at the input layer, LAPE is a multi-stage module. It dynamically adds learnable weights to specific positions throughout the network, preventing the decay of spatial information in deeper layers.
- Group Normalization Multi-head Attention (GNMA): Standard attention mechanisms can be biased toward large, prominent visual elements. GNMA utilizes group normalization to balance attention across different feature groups, allowing the model to capture subtle global relational cues that might otherwise be overshadowed.
- Convolution-based Feature Enhancement Attention (CFEA): While transformers excel at long-range dependencies, they can lack precision regarding local textures. CFEA employs a two-branch convolutional structure to sharpen the model's focus on local spatial details.
The integration of these modules allows for a more robust representation of visual-spatial relationships. Specifically, the multi-stage nature of LAPE ensures that the "sense of place" is maintained throughout the feature extraction and fusion process.
Experimental Setup
The VRST model was evaluated on the MSCOCO (Microsoft Common Objects in Context) dataset, which contains over 120,000 images with five human-annotated captions each. We utilized the standard "Karpathy split" for offline testing and submitted our results to the official MSCOCO evaluation server for benchmarking against state-of-the-art models.
Results and Discussion
The VRST model demonstrates superior performance compared to established baselines such as AoANet and DLCT. Quantitatively, the model achieved a CIDEr score of 141.9 on the Karpathy test split and 138.2 on the official evaluation server. It also showed competitive results across other standard metrics, including BLEU-4 and METEOR.
Qualitatively, the model exhibits a refined ability to select spatially accurate verbs. For instance, in scenarios where baseline models might describe animals as "walking," VRST correctly identifies them as "standing" by better interpreting the relationship between the subjects and the ground plane. This improvement is attributed to the high-dimensional alignment in SAPE and the balanced attention provided by GNMA.
Conclusion
The Visual-Spatial Relationship Sensitive Transformer effectively bridges the gap between global context and local object details in image captioning. While the model achieves state-of-the-art results, limitations remain, such as occasional misidentification in highly cluttered scenes and a relatively high computational footprint (565MB). Future work will explore the integration of open-vocabulary backbones like CLIP and optimization techniques to reduce memory usage for edge deployment.
Summary updated