Abstract
DALG (Deep Attentive Local and Global modeling) is a novel image retrieval framework that replaces traditional convolutional neural networks (CNNs) with a fully attention-based architecture. By utilizing Swin-Transformers and a learnable cross-attention fusion module, DALG achieves state-of-the-art accuracy using single-scale inference, offering up to a 6x speedup over previous multi-scale models.
Introduction
In image retrieval, the objective is to identify images within a massive database that match a specific query. Traditionally, this has been a two-stage process: a global search followed by local re-ranking. While recent "single-stage" models like DOLG attempted to unify these steps, they remained constrained by the limited receptive fields of CNNs. To compensate, these models relied on computationally expensive multi-scale testing—running the model multiple times at different image sizes.
DALG addresses this efficiency bottleneck by moving to a fully attention-based paradigm. By leveraging the inherent global context of Transformers, DALG achieves high precision with a single pass at a single scale, significantly reducing inference time.
Methodology
The DALG architecture is built upon the Swin-Transformer and consists of three primary components designed to capture and fuse diverse visual information.
1. Global and Local Branches
The Global Branch utilizes a standard Swin-Transformer backbone to extract high-level semantic features from the entire image. Simultaneously, a Local Branch diverges from the middle of the Transformer. This branch employs Window-based Multi-head Self-Attention (Win-MSA) with overlapped windows to capture fine-grained local patterns. A spatial attention module then highlights the most relevant local features, mimicking importance sampling.
2. Cross-Attention Fusion
Unlike previous methods that used handcrafted mathematical formulas (e.g., orthogonal fusion) to merge features, DALG introduces a learnable Cross-Attention module. This allows the model to dynamically determine the optimal way to combine local and global information based on the training data.
3. Training Strategy
To prevent feature "pollution" between branches, the authors implemented a stop-gradient strategy. This ensures that the local branch maintains its focus on fine-grained details without being overshadowed by the global branch's semantic optimization during the early stages of training.
Key Insights
- Attention-Centric Retrieval: Transformers are naturally suited for retrieval because their self-attention mechanism captures global context more effectively than CNNs, eliminating the need for multi-scale tricks.
- Learnable Fusion: Moving from fixed mathematical rules to data-driven cross-attention provides a significant boost in feature complementarity.
- Efficiency via Single-Scale: The transition to a single-scale paradigm removes a massive computational burden, making high-performance retrieval practical for real-time applications.
Experimental Results
DALG was evaluated on major benchmarks including Google Landmarks v2 (GLDv2), Revisited Oxford (Roxf), and Revisited Paris (Rpar).
- Efficiency: The Swin-S-DALG variant is 6x faster than the previous state-of-the-art R101-DOLG while maintaining competitive accuracy.
- Accuracy: On GLDv2-clean, Swin-S-DALG achieved a 33.0% mAP, significantly outperforming the 26.8% of the DELG model.
- Scalability: The model demonstrated robustness even when tested against 1 million distractor images (R1M), proving its readiness for large-scale real-world deployment.
Conclusion
DALG represents a significant shift in image retrieval, demonstrating that fully attentive models can outperform CNN-based architectures in both speed and accuracy. By abandoning the multi-scale legacy of CNNs, DALG paves the way for more efficient, single-scale retrieval systems. Future work may involve exploring more lightweight Transformer backbones to further enhance performance for mobile and edge applications.
Summary updated