Abstract
Deep hashing has become a cornerstone of large-scale image retrieval due to its efficiency in compressing high-dimensional data into compact binary codes. However, these systems are susceptible to targeted adversarial attacks, where an attacker aims to manipulate retrieval results toward a specific incorrect category. Traditional optimization-based attacks are computationally expensive and often fail to capture category-level semantics. We propose the Prototype-supervised Adversarial Network (ProS-GAN), the first generative framework for targeted hashing attacks. ProS-GAN learns representative "prototype" hash codes and utilizes a generator to produce adversarial examples in a single forward pass. Experimental results on FLICKR-25K, NUS-WIDE, and MS-COCO demonstrate that ProS-GAN is approximately 1660x faster than state-of-the-art iterative methods while achieving superior attack success rates and transferability.
Introduction
The explosion of visual data has necessitated efficient retrieval mechanisms. Deep hashing models address this by mapping images to a low-dimensional Hamming space. Despite their success, the vulnerability of these models to adversarial perturbations—small, human-imperceptible changes—poses a significant security risk. In a targeted attack scenario, an adversary seeks to force the retrieval system to return images from a specific target class, potentially leading to misinformation or the bypassing of content filters.
Previous attempts at targeted hashing attacks primarily relied on iterative optimization. These methods are not only slow, taking several seconds per image, but also rely on "anchor codes"—often the hash code of a single randomly selected image from the target class. Such anchors rarely represent the full semantic distribution of the target category, leading to suboptimal attack performance.
The ProS-GAN Framework
ProS-GAN shifts the paradigm from per-image optimization to a generative approach. The architecture, illustrated in Figure 1, comprises three synergistic components designed to maximize attack efficiency and semantic accuracy.
PrototypeNet ($P$)
Instead of using heuristic anchor codes, PrototypeNet learns a category-level "prototype code" ($h_t$). By processing the target label ($y_t$) through a series of fully connected layers, it generates a semantic representation ($r_t$) and a corresponding binary code. A pair-wise similarity loss ensures that these prototypes are well-separated in the Hamming space for different categories while remaining representative of their respective classes.
Adversarial Generator ($G$)
The generator is an encoder-decoder network that takes an original image $x$ and the semantic representation $r_t$ as inputs. It produces an adversarial image $x'$ designed to minimize the Hamming distance between its hash code (produced by the target hashing model $F$) and the target prototype code $h_t$. Because it is a feed-forward network, it can generate adversarial examples nearly instantaneously.
Multi-task Discriminator ($D$)
To ensure the adversarial images remain imperceptible and semantically grounded, the discriminator performs two tasks:
- Real/Fake Discrimination: Maintaining the visual quality of the generated images.
- Category Classification: Forcing the generator to embed features of the target category into the adversarial image, which enhances the effectiveness of the attack against the hashing model.
Experimental Evaluation
ProS-GAN was evaluated against leading benchmarks, including P2P and DHTA, using three major datasets: FLICKR-25K, NUS-WIDE, and MS-COCO. The primary metric for effectiveness was targeted Mean Average Precision (t-MAP), which quantifies the relevance of retrieved images to the attacker's target class.
Performance and Efficiency
As shown in Figure 2, ProS-GAN consistently outperforms existing methods across various bit lengths and datasets. In the MS-COCO dataset (24-bit), ProS-GAN achieved a t-MAP of 71.28%, a significant improvement over DHTA's 61.90%.
Beyond accuracy, the most striking result is the speed. ProS-GAN generates adversarial examples in approximately 0.005 seconds per image. This represents a 1660x speedup over DHTA, which requires 5 to 9 seconds per image due to its iterative nature. This efficiency makes real-time, large-scale adversarial attacks a viable threat.
Transferability
A key strength of ProS-GAN is its transferability. Adversarial images generated to target one hashing model (e.g., based on AlexNet) were found to be highly effective at fooling other models (e.g., VGG or ResNet). In black-box scenarios, ProS-GAN showed an 8.84% improvement in attack success over baselines, suggesting that the learned prototypes capture universal semantic vulnerabilities in deep hashing architectures.
Conclusion
ProS-GAN demonstrates that generative models, guided by learned semantic prototypes, can launch devastatingly fast and effective targeted attacks on deep hashing systems. By moving beyond slow optimization and heuristic anchors, this work highlights a critical security gap in current image retrieval pipelines. Future research must focus on developing robust defenses, such as specialized adversarial training, to protect the discrete Hamming spaces used in large-scale retrieval.
Summary updated