Adversarial Defense by Stratified Convolutional Sparse Coding.

Bo Sun, Nian-Hsuan Tsai, Fangchen Liu, Ronald Yu, Hao Su

Abstract

We propose an adversarial defense method that achieves state-of-the-art performance among attack-agnostic adversarial defense methods while also maintaining robustness to input resolution, scale of adversarial perturbation, and scale of dataset size. Based on convolutional sparse coding, we construct a stratified low-dimensional quasi-natural image space that faithfully approximates the natural image space while also removing adversarial perturbations. We introduce a novel Sparse Transformation Layer (STL) in between the input image and the first layer of the neural network to efficiently project images into our quasi-natural image space. Our experiments show state-of-the-art performance of our method compared to other attack-agnostic adversarial defense methods in various adversarial settings.

Introduction

Deep neural networks (DNNs) have demonstrated remarkable performance across various computer vision tasks. However, they remain vulnerable to adversarial attacks—tiny, often imperceptible perturbations added to an input image that cause a model to misclassify it with high confidence.

Existing defenses generally fall into two categories: adversarial training and input transformation. Adversarial training involves retraining models on attacked images, which is effective but often specific to certain attack types and lacks generalization. Input transformation methods aim to "clean" the image before it reaches the model. While more flexible and attack-agnostic, these methods often struggle with high-resolution images, fail against large perturbations, or "over-smooth" the image, losing critical fine details. This work introduces a method that is both attack-agnostic and model-agnostic, capable of being integrated with any existing classifier.

Methodology: The Sparse Transformation Layer (STL)

The core of our approach is the Sparse Transformation Layer (STL), which acts as a gatekeeper between the input image and the neural network. The STL projects images into a "quasi-natural image space"—a low-dimensional representation that captures essential structures of real-world objects while filtering out high-frequency adversarial noise.

Convolutional Sparse Coding (CSC)

The STL utilizes Convolutional Sparse Coding (CSC) to reconstruct the input image. Instead of passing pixels directly, the image is represented as a combination of learned filters. By maintaining a small and sparse dictionary of filters, the system is physically constrained from reconstructing the complex, chaotic patterns characteristic of adversarial noise.

Stratification and the Quasi-Natural Image Space

A single dictionary is insufficient to represent the vast diversity of natural images. To address this, we employ stratification. We use a Denoising Auto-Encoder (DAE) to map images into a latent perceptual space, which is then clustered using K-means. Each cluster is assigned its own specialized dictionary. When an image is processed, the system identifies its cluster and uses the corresponding specialized dictionary to "purify" it.

Conceptual overview of the Quasi-natural Image Space compared to the Natural Image Space. The STL projects adversarial examples back onto a manifold where they are close to their original counterparts in feature space.

As shown in the figure above, adversarial examples ($x_{adv}$) typically lie "off the manifold" of natural images, leading to large distances in the feature space of a neural network. By applying the transformation $T(\cdot)$ via our STL, both the original image ($x_0$) and the adversarial version are projected into the "Quasi-natural Image Space." In this space, their representations are significantly closer, effectively stripping away the adversarial perturbation and restoring the model's predictive accuracy.

Experimental Results

We evaluated our method on three primary benchmarks: CIFAR-10 (32x32), ImageNet-10 (64x64 and 128x128), and the full ImageNet dataset.

Robustness and Scalability

  • State-of-the-Art Performance: On CIFAR-10, our method achieved 85.67% accuracy against FGSM attacks (with a 0.08 perturbation), significantly outperforming popular defenses like MagNet (~73%) and PixelDefend (~83%).
  • Resolution Scaling: Unlike many previous methods limited to low-resolution inputs, our method maintained high performance at 128x128 and 224x224 resolutions.
  • Visual Quality: Qualitatively, STL-reconstructed images appear much sharper and more "natural" than those from competing methods, which often introduce blurring or checkerboard artifacts.

Key Insights

The effectiveness of the STL stems from filter sparsity acting as a shield. By forcing reconstruction through a limited set of "smooth" filters, jagged adversarial noise is naturally excluded. Furthermore, the optimization process involved in sparse coding (solved via the ADMM algorithm) introduces a form of gradient obfuscation, making it harder for attackers to generate effective gradients for white-box attacks.

Conclusion and Future Work

We have presented a novel defense mechanism based on stratified convolutional sparse coding. By projecting inputs into a quasi-natural image space, we can effectively remove adversarial perturbations while preserving image details. While highly robust against black-box and grey-box attacks, future work will focus on improving computational efficiency for real-time applications and further enhancing robustness against sophisticated white-box attacks that account for the non-differentiable nature of the STL.

Summary updated

BibTeX
@inproceedings{sun2019adversarial,
  author = {Bo Sun and Nian-Hsuan Tsai and Fangchen Liu and Ronald Yu and Hao Su},
  title = {{Adversarial Defense by Stratified Convolutional Sparse Coding.}},
  booktitle = {CVPR},
  year = {2019},
  url = {https://openreview.net/forum?id=rmKWXmmeO6B},
}
Figure