Abstract
Image-text retrieval is a fundamental task in cross-modal AI, requiring the alignment of visual regions with textual descriptions. Traditional models often overlook the dynamic global context within a single modality. This paper introduces the Context-Aware Attention Network (CAAN), which simultaneously models inter-modal alignments and intra-modal correlations. By utilizing a novel second-order attention mechanism, CAAN adaptively focuses on relevant features based on the global context. Experimental results on MS-COCO and Flickr30K demonstrate that CAAN outperforms existing non-BERT methods while being orders of magnitude faster and smaller than large-scale Transformer models.
Introduction: The Semantic Gap and Global Context
The primary challenge in image-text retrieval is the "semantic gap"—the difficulty of comparing pixel-based visual vectors with word-based textual vectors. While early attention-based models like SCAN attempted to align local fragments (e.g., matching the word "dog" to a specific bounding box), they often failed to account for how the importance of these fragments changes based on the overall sentence or image context.
For instance, a general query about "fruit" requires grouping various regions together, whereas a specific query about "pineapples" requires the model to distinguish that specific region from others. Previous methods struggled with this adaptive intra-modal correlation.
Methodology: The CAAN Architecture
The Context-Aware Attention Network (CAAN) is designed to bridge the semantic gap through a unified attention framework. The architecture consists of three core stages: feature extraction, inter-modal attention, and semantics-based intra-modal attention.
1. Feature Extraction
- Visual Features: Visual regions are extracted using a Faster R-CNN (ResNet-101) pre-trained on Visual Genome, providing "bottom-up" attention bounding boxes for objects.
- Textual Features: A bi-directional GRU (Bi-GRU) encodes words to capture the surrounding sentence context.
2. Inter-modal Attention
This component calculates the cross-attention between every image region and every word in the sentence. It identifies which visual fragments align with which textual fragments, forming the basis for initial similarity scores.
3. Semantics-based Intra-modal Attention
The key innovation of CAAN is its "second-order" attention mechanism for intra-modal correlation. Rather than comparing raw, static features, the model evaluates how two regions (or words) respond to the same elements in the opposing modality. If two image regions are both highly relevant to the same words in a query, they are treated as highly correlated within that specific context. This allows the model to dynamically "summarize" the image based on what the text is seeking.
Experimental Results and Performance
The model was evaluated on the MS-COCO and Flickr30K benchmarks, showing superior performance and efficiency.
Accuracy
On the MS-COCO (1K) test split, CAAN achieved a Recall@1 (R@1) of 75.5% for sentence retrieval, surpassing the previous state-of-the-art non-BERT model (BFAN) by nearly 2%.
Efficiency
A major advantage of CAAN is its computational efficiency compared to heavy BERT-based models like ViLBERT:
- Latency: CAAN computes pair similarity in approximately 45 microseconds, making it over 10,000 times faster than ViLBERT (~0.5 seconds).
- Model Size: With only 11 million parameters, CAAN is significantly more compact than ViLBERT’s 275 million parameters, facilitating deployment in resource-constrained environments.
Conclusion and Future Directions
CAAN demonstrates that context-aware, second-order attention can significantly enhance cross-modal retrieval without the massive overhead of full Transformer architectures. While it currently relies on object-centric visual features—which may limit its understanding of abstract concepts or background textures—it provides a powerful and efficient baseline for future research. Potential future work includes integrating scene graph information and exploring larger-scale pre-training to further bridge the gap with massive multi-modal Transformers.
Summary updated