Semantic Perturbations with Normalizing Flows for Improved Generalization

Oguz Kaan Yüksel, Sebastian U. Stich, Martin Jaggi, Tatjana Chavdarova

Abstract

Data augmentation is a cornerstone of modern deep learning, yet traditional methods are often limited to simple geometric transformations. This paper explores "on-manifold" semantic data augmentation by leveraging the exact invertibility of Normalizing Flows (NFs). By performing perturbations in the latent space of an NF, we generate semantically consistent variations of training samples. We introduce Randomized and Adversarial Latent Attacks (LA) and demonstrate that these methods significantly enhance classifier generalization, particularly in low-data regimes where they achieve up to a 25% relative improvement in accuracy.

Introduction

Deep learning models typically require vast amounts of labeled data to generalize effectively. Data Augmentation (DA) mitigates this by creating synthetic training samples through transformations like flipping or cropping. However, these are domain-specific and do not capture complex semantic variations, such as changing an object's color or style.

Previous attempts at semantic augmentation using Variational Autoencoders (VAEs) or Generative Adversarial Networks (GANs) often fail because these models lack exact invertibility. VAEs introduce reconstruction noise, while GANs are difficult to invert, often pushing generated samples "off-manifold"—away from the distribution of real data. This noise can degrade classifier performance by introducing artifacts that do not exist in the natural data distribution.

Methodology

We propose using Normalizing Flows (NFs), specifically the Glow architecture, to perform latent-space perturbations. NFs are designed to be exactly reversible, allowing for a bijective mapping between the image space $x$ and the latent space $z$. This mathematical exactness eliminates the "reconstruction noise" inherent in VAEs.

Comparison of VAE-GAN and Normalizing Flow architectures for data augmentation.

We define two types of Latent Attacks (LA):

  1. Randomized-LA (R-LA): Simple Gaussian noise is added to the latent representation $z$. Because the NF is trained on the data distribution, these random shifts correspond to plausible semantic changes in the image space.
  2. Adversarial-LA (A-LA): Perturbations are computed in the latent space to maximize the loss of the classifier being trained. This "smart" augmentation forces the classifier to learn from challenging yet realistic "on-manifold" examples.

Experimental Results

The proposed methods were evaluated on standard benchmarks including CIFAR-10, CIFAR-100, FashionMNIST, and SVHN.

Performance in Low-Data Regimes

A key finding is the effectiveness of semantic perturbations when training data is scarce. On a 5% subset of CIFAR-10, Adversarial-LA improved test accuracy from 49.8% (standard) to 80.4%, significantly outperforming established techniques like Mixup (73.4%) and Cutout (66.8%).

Test accuracy across varying training set sizes, highlighting the advantage of Adversarial-LA in low-data regimes.

Generalization and Visual Quality

On the full CIFAR-10 dataset, our method reached 96.6% accuracy with a ResNet-18. Beyond accuracy, the visual quality of the augmented samples is superior to traditional adversarial training. Using the Fréchet Inception Distance (FID), latent perturbations yielded an FID of ~3.6, compared to ~23.6 for standard image-space adversarial attacks, confirming that the generated samples remain firmly on the data manifold.

Conclusion

By exploiting the exact invertibility of Normalizing Flows, we enable a new class of semantic data augmentation that stays true to the data manifold. While computationally more intensive than traditional DA due to the required forward and backward passes through the flow, the gains in generalization—especially in data-limited scenarios—are substantial. Future work will focus on reducing computational overhead and exploring class-conditional flows for more granular control over semantic transformations.

Summary updated

BibTeX
@inproceedings{yuksel2021semantic,
  author = {Oguz Kaan Yüksel and Sebastian U. Stich and Martin Jaggi and Tatjana Chavdarova},
  title = {{Semantic Perturbations with Normalizing Flows for Improved Generalization}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00655},
}
Figure