RAIN: A Simple Approach for Robust and Accurate Image Classification Networks

Jiawei Du, Hanshu Yan, Vincent Y. F. Tan, Joey Tianyi Zhou, Rick Siow Mong Goh, Jiashi Feng

TL;DR

RAIN (Robust and Accurate Image classificatioN) is a simple, plug-in preprocessing framework that protects CNN classifiers against adversarial attacks while preserving high clean-image accuracy. By combining randomized downsampling and circular shifting with a deep super-resolution network, RAIN breaks adversarial gradient paths and restores the critical high-frequency details typically lost in preprocessing defenses.

What Problem Does This Paper Address?

Deep neural networks are notoriously vulnerable to adversarial attacks—visually imperceptible perturbations designed to trick models into making incorrect predictions. While defenses like adversarial training (AT) and input preprocessing exist, they almost universally suffer from a frustrating trade-off: improving robustness severely degrades the model's accuracy on clean, unperturbed images.

Input preprocessing defenses typically use randomized transformations (like padding or resizing) to disrupt the attacker's gradient calculations. However, these transformations also destroy the clean data distribution, leading to poor performance in real-world deployments where the vast majority of inputs are clean. RAIN aims to break this trade-off, offering a computationally efficient preprocessing defense that maintains high clean accuracy.

Methods

RAIN acts as a plug-in preprocessing pipeline before the image is fed into a standard CNN classifier. The pipeline consists of three sequential steps:

  1. Randomized Downsampling (within the RdmDU module): The input image is partitioned into non-overlapping $2 \times 2$ patches, and one pixel is randomly selected from each patch. This breaks the spatial structure of adversarial perturbations.
  2. Randomized Small Circular Shift (RdmSCS): The downsampled image is circularly shifted along a random direction by a small, random number of pixels. Circular shifting (splicing the shifted edge back to the opposite side) preserves global image statistics and frequency components much better than standard zero-padding.
Illustration of the Randomized Small Circular Shift (RdmSCS) module showing how circular shifting preserves image boundaries compared to zero-padding.
  1. Detail Enhancement via Super-Resolution (SR): Instead of standard bicubic interpolation (which blurs images and drops accuracy), RAIN uses a deep super-resolution network (specifically, EDSR) to upscale the image back to its original size. Crucially, the EDSR parameters are fine-tuned using the classification loss of the target CNN (while keeping the CNN frozen) to ensure the reconstructed high-frequency details are optimized for classification.

Datasets

The authors evaluated their framework on two standard image classification benchmarks:

  • STL10: A dataset featuring $96 \times 96$ images across 10 classes, commonly used for evaluating image recognition algorithms.
  • ImageNet: The large-scale benchmark dataset containing high-resolution images across 1,000 classes.

Key Insights and Ideas

  • High-Frequency Details Matter: Through empirical analysis, the authors discovered that the accuracy drop caused by preprocessing defenses is primarily due to the loss of high-frequency components (textures, sharp edges). When they systematically filtered out high-frequency data while keeping image energy constant, CNN classification accuracy plummeted.
Classification accuracy drops sharply as a function of the threshold of high-frequency components removed, proving that high frequencies are critical for clean accuracy.
  • Task-Specific Reconstruction: Standard image upsampling methods treat all pixels equally, suppressing high frequencies. By replacing this with a deep super-resolution network fine-tuned against the classifier's loss, the framework selectively restores the exact high-frequency details the CNN relies on for accurate inference.
  • Feature Map Purification: Adversarial noise typically distorts the feature maps in the deep layers of a CNN, activating irrelevant pixels. RAIN effectively purifies these feature maps, making the internal activations of an adversarial image closely resemble those of its clean counterpart.
Feature map comparison showing how RAIN purifies internal CNN activations, suppressing the scattered noise caused by adversarial attacks.

Key Results

  • White-Box Robustness & Accuracy: On ImageNet, RAIN achieved a clean accuracy of 93.3% (losing only 6.7% from the baseline 100% clean accuracy) while boosting robustness against the C&W attack from 0% to 52.3% and DeepFool from 0% to 86.7%. This significantly outperforms other preprocessing methods like Pixel Deflection, which dropped clean accuracy to 85.8%.
  • Black-Box Performance: RAIN achieved the highest black-box adversarial robustness against ZOO (88.5% on ImageNet) and RayS (92.4% on ImageNet) attacks compared to baseline competitors.
  • Defeating EoT Attacks: When combined with adversarial training (RAIN-AT), the framework successfully defended against advanced Expectation over Transformation (EoT) attacks, achieving 65.6% clean accuracy on ImageNet compared to 56.9% for competing methods (RandR&P-AT).

Limitations and Future Work

  • Low-Resolution Constraints: RAIN relies heavily on the super-resolution module to recover details after randomized downsampling. If the initial input image is already very low-resolution or heavily degraded, downsampling may destroy too much semantic information for the SR model to reliably reconstruct.
  • Theoretical Guarantees: The current framework is entirely empirical. The authors note that future work should focus on analyzing the fundamental theoretical limits of the accuracy-robustness trade-off to provide formal defense guarantees.

Summary updated

BibTeX
@misc{du2020rain,
  author = {Jiawei Du and Hanshu Yan and Vincent Y. F. Tan and Joey Tianyi Zhou and Rick Siow Mong Goh and Jiashi Feng},
  title = {{RAIN: A Simple Approach for Robust and Accurate Image Classification Networks}},
  year = {2020},
  eprint = {2004.14798},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2004.14798},
}
Figure