Anomaly Unveiled: Securing Image Classification against Adversarial Patch Attacks

Nandish Chattopadhyay, Amira Guesmi, Muhammad Shafique

Abstract

Adversarial patch attacks pose a significant threat to the practical deployment of deep learning systems. However, existing research primarily focuses on image pre-processing defenses, which often result in reduced classification accuracy for clean images and fail to effectively counter physically feasible attacks. In this paper, we investigate the behavior of adversarial patches as anomalies within the distribution of image information and leverage this insight to develop a robust defense strategy. Our proposed defense mechanism utilizes a clustering-based technique called DBSCAN to isolate anomalous image segments, which is carried out by a three-stage pipeline consisting of Segmenting, Isolating, and Blocking phases to identify and mitigate adversarial noise. Upon identifying adversarial components, we neutralize them by replacing them with the mean pixel value, surpassing alternative replacement options. Our model-agnostic defense mechanism is evaluated across multiple models and datasets, demonstrating its effectiveness in countering various adversarial patch attacks in image classification tasks. Our proposed approach significantly improves accuracy, increasing from 38.8% without the defense to 67.1% with the defense against LaVAN and GoogleAp attacks, surpassing prominent state-of-the-art methods such as LGS (53.86%) and Jujutsu (60%).

Introduction

Deep Neural Networks (DNNs) are notoriously fragile when faced with adversarial patches. Unlike traditional adversarial attacks that subtly alter every pixel in an image, patch attacks are localized, high-intensity perturbations. These can be thought of as physical stickers placed on objects to deceive computer vision systems—for instance, making a self-driving car misidentify a stop sign as a speed limit sign.

Existing defenses often face a "utility-security" trade-off: they either require expensive model retraining or apply pre-processing filters that degrade the accuracy of clean images. Furthermore, many defenses fail to distinguish between legitimate image features and adversarial noise, leading to high false-positive rates. This research seeks a way to "blind" the model to the patch without compromising its ability to perceive the rest of the image.

Proposed Defense Mechanism

The proposed defense is a three-stage pipeline that treats adversarial noise as an outlier in the image's information distribution. This model-agnostic approach can be integrated with any existing architecture (e.g., ResNet, VGG) without modification.

Overview of the defense pipeline showing the transition from an attacked input (misclassified as 'Toaster') to a correctly classified output ('Pug-dog') via Segmenting, Isolating, and Blocking phases.

1. Segmenting Phase

The input image is parsed using a moving window to create overlapping segments (kernels). These segments are converted into vectors to serve as data points for statistical analysis.

2. Isolating Phase

This phase employs DBSCAN (Density-Based Spatial Clustering of Applications with Noise), an unsupervised clustering algorithm. Because adversarial patches contain information that diverges significantly from the natural image distribution, DBSCAN identifies these segments as "Noise" (outliers) rather than part of a legitimate cluster.

Visualization of the Isolating Phase where DBSCAN identifies anomalous segments (black dots) that deviate from the main clusters.

3. Blocking Phase

Once anomalous segments are identified, they are neutralized. The researchers found that replacing these pixels with the mean pixel value of the segment was more effective than using minimum or maximum values for restoring classification accuracy.

Experimental Evaluation

The defense was evaluated using the ImageNet and CalTech-101 datasets across several models, including ResNet-50, ResNet-152, and VGG-19.

Key Insights

  • Statistical Disparity: Using Mahalanobis distance, the researchers observed a clear bi-modal distribution: clean segments cluster together, while adversarial segments form a distinct, high-distance peak. This statistical gap is the foundation of the anomaly detection effectiveness.
  • Resilience to Adaptive Attacks: Even when faced with "stealthy" patches designed to mimic the image's mean and standard deviation, the resulting distribution remained "heavy-tailed," allowing the defense to remain effective.

Results

The proposed defense significantly outperformed existing benchmarks:

  • Accuracy Improvement: Against GoogleAp attacks on ImageNet (using ResNet-50), accuracy increased from 38.8% (undefended) to 67.1% (defended).
  • Competitive Performance: The method surpassed state-of-the-art defenses like LGS (53.86%) and Jujutsu (60%).
  • Clean Accuracy Preservation: Baseline performance on clean samples remained high (e.g., 78.4% for ResNet-50 on ImageNet), indicating that the defense does not overly penalize non-adversarial images.

Conclusion

By treating adversarial patches as statistical anomalies, this defense mechanism provides a robust, model-agnostic shield for image classification. While the approach shows significant promise, future work will address hyperparameter sensitivity in DBSCAN and explore extending the framework to more complex tasks like object detection.

Summary updated

Abstract

Adversarial patch attacks pose a significant threat to the practical deployment of deep learning systems. However, existing research primarily focuses on image pre-processing defenses, which often result in reduced classification accuracy for clean images and fail to effectively counter physically feasible attacks. In this paper, we investigate the behavior of adversarial patches as anomalies within the distribution of image information and leverage this insight to develop a robust defense strategy. Our proposed defense mechanism utilizes a clustering-based technique called DBSCAN to isolate anomalous image segments, which is carried out by a three-stage pipeline consisting of Segmenting, Isolating, and Blocking phases to identify and mitigate adversarial noise. Upon identifying adversarial components, we neutralize them by replacing them with the mean pixel value, surpassing alternative replacement options. Our model-agnostic defense mechanism is evaluated across multiple models and datasets, demonstrating its effectiveness in countering various adversarial patch attacks in image classification tasks. Our proposed approach significantly improves accuracy, increasing from 38.8\% without the defense to 67.1\% with the defense against LaVAN and GoogleAp attacks, surpassing prominent state-of-the-art methods such as LGS (53.86\%) and Jujutsu (60\%)

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
ImageNet-1K · GoogleAp attack on ImageNetAnomaly Unveiled defense (Ours; DBSCAN-based pipeline)Robust accuracy67.1%attack=GoogleAp · backbone=ResNet-50
Source quote
L332: Ours │ 67.1%
Caltech-101 · GoogleAp attack on CalTech-101Anomaly Unveiled defense (Ours; DBSCAN-based pipeline)Robustness (w/ patch)76.5%attack=GoogleAp · backbone=ResNet-50 · patch-size=38 × 38 · resolution=38x38
Source quote
L268: ResNet 50 │ 90.9% │ 49.2% │ 76.5%
Caltech-101 · LAVAN attack on CalTech-101Anomaly Unveiled defense (Ours; DBSCAN-based pipeline)Robustness (w/ patch)73.6%attack=LaVAN · backbone=ResNet-50 · patch-size=38 × 38 · resolution=38x38
Source quote
L295: ResNet 50 │ 90.9% │ 17.1% │ 73.6%
Reported baseline / comparator measurements (3)
BenchmarkMethodMetricScoreProtocol / Evidence
LaVAN and GoogleAp adversarial patch attacksNo defense (undefended classifier) baselineAccuracy38.8%Abstract reports this as the accuracy before applying the defense; model, dataset, and …
Source quote
L5: Our proposed approach significantly improves accuracy, increasing from 38.8% without the defense to 67.1% with the defense against LaVAN and GoogleAp attacks, surpassing prominent state-of-the-art methods such as LGS \cite{naseer2019local} (53.86%) and Jujutsu \cite{Jujutsu} (60%).
GoogleAp attackLGS baselineRobust accuracy53.86%attack=GoogleAp
Source quote
L324: LGS \cite{naseer2019local} │ 53.86%
GoogleAp attackJujutsu baselineRobust accuracy60%attack=GoogleAp
Source quote
L330: Jujutsu \cite{Jujutsu} │ 60%
BibTeX
@inproceedings{chattopadhyay2024anomaly,
  author = {Nandish Chattopadhyay and Amira Guesmi and Muhammad Shafique},
  title = {{Anomaly Unveiled: Securing Image Classification against Adversarial Patch Attacks}},
  booktitle = {ICIP},
  year = {2024},
  doi = {10.1109/icip51287.2024.10648223},
}
Figure