Abstract
Instance-level image retrieval is the task of searching in a large database for images that match an object in a query image. To address this task, systems usually rely on a retrieval step that uses global image descriptors, and a subsequent step that performs domain-specific refinements or reranking by leveraging operations such as geometric verification based on local features. In this work, we propose Reranking Transformers (RRTs) as a general model to incorporate both local and global features to rerank the matching images in a supervised fashion and thus replace the relatively expensive process of geometric verification. RRTs are lightweight and can be easily parallelized so that reranking a set of top matching results can be performed in a single forward-pass. We perform extensive experiments on the Revisited Oxford and Paris datasets, and the Google Landmarks v2 dataset, showing that RRTs outperform previous reranking approaches while using much fewer local descriptors. Moreover, we demonstrate that, unlike existing approaches, RRTs can be optimized jointly with the feature extractor, which can lead to feature representations tailored to downstream tasks and further accuracy improvements.
Introduction: The Reranking Bottleneck
Instance-level image retrieval is often described as the "needle in a haystack" problem of computer vision. Given a query image—such as a specific landmark, a piece of artwork, or a commercial product—the goal is to find the exact same instance within a database containing millions of images.
Standard state-of-the-art systems typically employ a two-stage pipeline:
- Global Retrieval: A fast initial search using compact "global descriptors" to identify the top-N candidate matches.
- Reranking: A slower, high-precision refinement of these candidates using detailed "local features."
Historically, the reranking stage has been the primary computational bottleneck. It traditionally relies on Geometric Verification (GV), which uses iterative algorithms like RANSAC to determine if local keypoints in two images can be mathematically aligned through a geometric model (e.g., a homography). While effective, GV is computationally expensive, difficult to parallelize, and "frozen"—meaning the feature extractor and the verification step cannot be trained together end-to-end.
Methodology: Reranking Transformers (RRTs)
The core innovation of this work is the Reranking Transformer (RRT). Instead of fitting a rigid geometric model, the RRT treats the reranking task as a supervised sequence-to-sequence problem, leveraging the self-attention mechanism to learn image similarity.
Architecture and Input Representation
For any given pair of images (a query and a candidate), the RRT processes a sequence of "tokens" that represent both global and local information. The input consists of:
- Global Descriptors: Providing a high-level context of the scene.
- Local Descriptors: Typically the top 500 local features, which include spatial information via position and scale embeddings.
- Special Tokens:
<CLS>for classification and<SEP>to separate the feature sets of the two images.
The model utilizes a standard Transformer encoder (6 layers, 4 heads). Through self-attention, the RRT learns to "attend" to corresponding regions across the image pair, effectively acting as an implicit geometer. Unlike the iterative nature of RANSAC, RRTs are highly parallelizable; reranking 100 images can be executed in a single batch forward pass.
Joint Optimization
Because the RRT is a fully differentiable neural network, the entire pipeline—from the CNN backbone extracting features to the Transformer performing the comparison—can be fine-tuned jointly using a binary cross-entropy loss. This allows the feature extractor to learn representations specifically optimized for the downstream reranking task.
Experimental Results
The authors evaluated RRTs on several industry-standard benchmarks, including Google Landmarks v2 (GLDv2), Revisited Oxford (ROxf), and Revisited Paris (RPar).
Performance and Efficiency
- State-of-the-Art Accuracy: RRTs consistently outperformed traditional GV and other methods like ASMK and Query Expansion ($\alpha$QE). On the ROxf "Hard" set, RRT improved mAP by 3.4% over GV, and on RPar "Hard," the improvement reached 8.4%.
- Efficiency: Using an NVIDIA P100 GPU, the RRT can rerank the top 100 neighbors in just 0.36 seconds, making it viable for high-throughput applications.
- Reduced Descriptor Count: While traditional GV often requires over 1,000 local descriptors, RRTs achieve peak performance with only 500, significantly reducing the storage footprint for local features.
The Impact of End-to-End Training
On the Stanford Online Products (SOP) dataset, which features deformable objects where rigid geometry often fails, fine-tuning the backbone alongside the RRT led to a 3.8% absolute improvement in R@1 accuracy compared to global-only retrieval. This demonstrates the power of tailoring feature representations to the specific reranking model.
Conclusion and Future Work
Reranking Transformers offer a modern, learnable alternative to classical geometric verification. By replacing rigid math with flexible self-attention, RRTs handle non-rigid deformations and extreme viewpoint changes more robustly while offering superior speed through parallelization.
However, some challenges remain. Unlike RANSAC, which provides a clear geometric transformation, RRTs operate as a "black box," making them less interpretable. Additionally, while they require fewer descriptors than GV, storing 500 local features per image for billion-scale databases remains a significant storage hurdle. Future research may focus on quantization techniques to further reduce the memory footprint of these local descriptors.
Summary updated