Distribution Mismatch Correction for Improved Robustness in Deep Neural Networks

Alexander Fuchs, Christian Knoll, Franz PernkopfarXiv 2021

Deep Neural Networks (DNNs) are notoriously brittle. A model that performs perfectly in the lab can fall apart when faced with real-world "noise"—think rain on a self-driving car's camera or graininess in a medical X-ray. This paper, "Distribution Mismatch Correction for Improved Robustness in Deep Neural Networks," introduces a clever, unsupervised way to fix this problem at test-time without ever needing to retrain the model.

TL;DR

The authors propose a non-parametric method to correct "covariate shift"—the mismatch between training and test data distributions—by matching the shape of activation distributions in each layer using the 1-D Wasserstein distance. This "plug-and-play" approach significantly improves the robustness of existing models against intense image corruptions without requiring any fine-tuning or labeled test data.

What Problem Does This Paper Address?

Most modern DNNs rely on normalization layers (like Batch Normalization) to train effectively. However, these layers often assume that the data seen during testing will look exactly like the data seen during training. When a model encounters corrupted images (noise, blur, brightness changes), the internal "activations" of the network shift away from what it expects. This is known as covariate shift.

While some newer normalization methods like Group Norm (GN) are more flexible, they generally only correct for linear changes, such as shifts in mean or variance. They can't handle changes in the actual shape of the distribution. The authors set out to find a way to "denoise" these internal activations by forcing them back into a shape the network recognizes.

Methods

The core idea is to treat distribution correction as a probabilistic denoising problem. The authors formulate an energy minimization scheme that balances two goals:

  1. Prior Term (Distribution Matching): This term uses the 1-D Wasserstein distance (a way to measure how much work it takes to transform one distribution into another) to align the test-time activation distribution with a "target" distribution derived from the training set. Because it's non-parametric, it can correct arbitrary distribution shapes, not just simple Gaussian ones.
  2. Likelihood Term (Structure Preservation): To ensure the correction doesn't just turn the image into a generic blob, this term penalizes large deviations from the original activation maps, preserving spatial correlations and important features.

The algorithm is iterative and applied layer-by-layer. A key detail is the sparsity constraint: since many activations in a ReLU-based network are zero, the algorithm explicitly avoids "reviving" these dead neurons, which would otherwise degrade performance.

Figure 2: Stacked channel histograms showing how the test-time activations (colored bars) are shifted to match the target training distribution (red line) after correction.

Datasets

The researchers evaluated their method on three standard benchmarks, each augmented with a variety of digital corruptions (noise, blur, weather effects, etc.):

  • MNIST-C: Corrupted versions of the classic handwritten digit dataset.
  • CIFAR-10-C: Corrupted versions of the 10-category object dataset.
  • ImageNet-C (ILSVRC 2012): A large-scale dataset with 19 different corruption types at 5 levels of severity.

Key Insights and Ideas

  • Shape Matters: Traditional normalization only fixes the "center" and "spread" of data. This paper shows that the shape of the activation distribution is a critical factor in robustness.
  • Layer-wise Stability: The authors found that while individual channel distributions vary wildly, the aggregate distribution across all channels in a layer is surprisingly stable during training. This makes it a reliable "anchor" for test-time correction.
  • No Labels Needed: Because the method is unsupervised and non-parametric, it can be retrofitted into any pre-trained model. You don't need to know what the noise is or have labeled examples of it.
  • Sparsity is Sacred: Forcing the correction to respect the zeros produced by ReLU layers was essential. Without this constraint, the "corrected" activations actually performed worse.

Key Results

The method showed the most dramatic improvements for models using standard Batch Normalization (BN), which is typically the most vulnerable to distribution shifts.

  • MNIST-C: For brightness-corrupted images, accuracy for a BN model jumped from 26.09% to 62.59%.
  • CIFAR-10-C: The average accuracy across all corruptions for BN models increased by 3.38%.
  • ImageNet-C: All models saw roughly a 1% improvement, with Group Norm (GN) models remaining the most robust overall.

Qualitatively, the effect is striking. As seen in Figure 1, the corrected activation maps for noisy inputs look much closer to the "clean" versions than the uncorrected ones.

Figure 1: Comparison between the mean activation maps of the first 5 layers of a ResNet-20 trained on MNIST for two different corruption types. Impulse noise maps are shown on the left and Brightness corrupted maps on the right. (c) indicates the activation maps which use our proposed distribution correction and the Diff column shows the pixel-wise difference between corrected and uncorrected activation maps.

Limitations and Future Work

The primary drawback is computational overhead. Sorting all activations in a layer to calculate the Wasserstein distance is expensive. On ImageNet, the evaluation time per image rose from 0.1 ms to 12 ms.

Additionally, the authors noted that the method can sometimes introduce distortions that slightly decrease performance on perfectly clean data or very low-intensity noise. Future work will likely focus on making the algorithm more efficient and refining the trade-off between distribution matching and spatial preservation to avoid these minor distortions.

Summary updated

BibTeX
@misc{fuchs2021distribution,
  author = {Alexander Fuchs and Christian Knoll and Franz Pernkopf},
  title = {{Distribution Mismatch Correction for Improved Robustness in Deep Neural Networks}},
  year = {2021},
  eprint = {2110.01955},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.01955},
}
Figure