Abstract: Most existing works of adversarial samples focus on attacking image recognition models, while little attention is paid to the image retrieval task. In this paper, we identify two inherent challenges in applying prevailing image recognition attack methods to image retrieval. First, image retrieval demands discriminative visual features, which is significantly different from the one-hot class prediction in image recognition. Second, due to the disjoint and potentially unrelated classes between the training and test set in image retrieval, predicting the query category from predefined training classes is not accurate and leads to a sub-optimal adversarial gradient. To address these limitations, we propose a new white-box attack approach, Opposite-Direction Feature Attack (ODFA), to generate adversarial queries. Opposite-Direction Feature Attack (ODFA) effectively exploits feature-level adversarial gradients and takes advantage of feature distance in the representation space. To our knowledge, we are among the early attempts to design an attack method specifically for image retrieval. When we deploy an attacked image as the query, the true matches are prone to receive low ranks. We demonstrate through extensive experiments that (1) only crafting adversarial queries is sufficient to fool the state-of-the-art retrieval systems; (2) the proposed attack method, ODFA, leads to a higher attack success rate than classification attack methods, validating the necessity of leveraging characteristics of image retrieval; (3) the adversarial queries generated by our method have good transferability to other retrieval models without accessing their parameters, i.e.,the black-box setting.
The Challenge of Open-Set Retrieval
While adversarial attacks on image classifiers are well-studied, image retrieval systems—which rely on feature similarity rather than fixed labels—remain a neglected frontier. Most adversarial research focuses on "closed-set" classification, where the goal is to nudge an image across a decision boundary into a different pre-defined category (e.g., turning a "panda" into a "gibbon").
Image retrieval is fundamentally different for two reasons:
- Feature-Centric: Retrieval depends on the distance between high-dimensional visual features, not a one-hot class prediction.
- Open-Set Nature: In retrieval, the classes encountered during testing (the "target set") often have zero overlap with the classes used during training (the "source set").
Traditional classification attacks struggle here because they rely on gradients from a classifier that might not even recognize the query's category. If one tries to attack a retrieval system using a "least-likely class" strategy on an unseen category, the resulting gradient is often sub-optimal and fails to significantly disrupt the ranking.
Opposite-Direction Feature Attack (ODFA)
The authors propose Opposite-Direction Feature Attack (ODFA), a white-box approach that bypasses the classification layer entirely to attack the intermediate feature representation.
Given an original query image $X$ with feature $f_X$, the attack seeks an adversarial image $X'$ such that its feature $f_{X'}$ is as far as possible from $f_X$. Specifically, it aims to minimize the cosine similarity between the two, effectively pushing $f_{X'}$ toward $-f_X$. By pushing a feature to the opposite direction, the similarity to all "true matches" (which are clustered near the original query) drops precipitously.
Optimization and Multi-Scale Robustness
The loss function is designed to minimize the squared distance between the normalized adversarial feature and the negative of the original normalized feature. Like the Basic Iterative Method (BIM), ODFA updates the image pixels over several steps using the sign of the gradient, while ensuring the total perturbation remains human-imperceptible (constrained by an $\epsilon$ hyperparameter).
To defeat robust retrieval systems that fuse features from multiple image scales, the authors developed ODFA-MS, a version that aggregates gradients across different input resolutions to ensure the attack remains potent regardless of how the victim processes the image.
Key Results and Insights
The attack performance was evaluated across five diverse image retrieval benchmarks, including Market-1501 (person re-ID), CUB-200-2011 (fine-grained birds), and Oxford5k/Paris6k (landmarks).
- Devastating Success: On the Market-1501 dataset, the victim model's Recall@1 dropped from 88.56% to a staggering 0.68% under ODFA.
- Outperforming Baselines: In almost every retrieval scenario, ODFA resulted in significantly lower accuracy than traditional methods like the Fast Gradient Sign Method (FGSM) or the Iterative Least-Likely Class method. This validates that attacking the "predicted class" of a retrieval query is inefficient compared to feature-level attacks.
- Transferability: One of the most significant findings is that adversarial queries generated for one model (e.g., ResNet-50) often successfully fool completely different architectures (e.g., DenseNet-121 or VGG-16) without any access to their parameters. This makes ODFA a viable threat in "black-box" scenarios.
Conclusion
ODFA demonstrates that image retrieval systems are highly vulnerable to feature-level adversarial perturbations. By leveraging the geometric characteristics of the latent space rather than relying on class labels, ODFA provides a more general and potent attack for open-set scenarios. Future work may explore how these feature-level attacks impact other vision tasks like semantic segmentation or object detection.
Summary updated