Adversarial and Random Transformations for Robust Domain Adaptation and Generalization

Liang Xiao, Jiaolong Xu, Dawei Zhao, Er-Ke Shang, Qi Zhu, Bin Dai · DOI

Abstract

This paper presents a unified framework for Domain Adaptation (DA) and Domain Generalization (DG) that combines simple consistency training with a novel, differentiable adversarial data augmentation strategy. By using Spatial Transformer Networks (STNs) to automatically find "worst-case" geometric transformations, the authors achieve state-of-the-art results across multiple benchmarks while significantly improving model robustness to real-world image corruptions.

Introduction: Addressing the Domain Shift Problem

Deep learning models are notoriously brittle when the data they encounter at test time differs from their training data—a phenomenon known as domain shift. For example, a self-driving car trained in sunny California might fail in a snowy Chicago winter.

Researchers typically use two strategies to fix this:

  1. Domain Adaptation (DA): Using unlabeled data from the "target" domain during training to help the model adjust.
  2. Domain Generalization (DG): Training on multiple "source" domains to learn features so universal they work on a completely unseen target domain.

While data augmentation (flipping, rotating, or recoloring images) helps, finding the best augmentations usually requires expensive search algorithms like reinforcement learning. Furthermore, most common image transformations are non-differentiable, meaning you can't use standard gradient descent to "train" the augmentation process itself.

Methodology

The authors propose two main components to solve these issues:

Overview of the proposed framework architecture, illustrating the flow of source and target domain data through random transformations and the adversarial STN.

1. Random Augmentation with Consistency Training

Instead of complex searching, the framework applies a set of random transformations (geometric and color-based) to an image. They then use a consistency loss (KL divergence) to force the model to produce the same prediction for both the original and the augmented version of the image. This acts as a form of "noise injection" that smoothens the model's decision boundaries.

A detailed list of the geometric, color-based, and other transformations utilized in the random augmentation stage, including their magnitude types and ranges.

2. Adversarial Spatial Transformer Networks (STN)

To move beyond random luck, the authors use an STN to create "hard" examples. Because affine transformations (rotation, translation, shearing) in an STN are differentiable, they can use a Gradient Reversal Layer (GRL). During training, the STN tries to transform the image in a way that maximizes the model's prediction error, while the main classification network tries to minimize it. This "cat-and-mouse" game forces the classifier to become robust against the most difficult geometric distortions.

Experimental Evaluation

The model was evaluated on a comprehensive suite of benchmarks:

  • DA/DG Benchmarks: PACS (Photo, Art, Cartoon, Sketch), Office-Home, ImageCLEF-DA, VLCS, and VisDA (Simulation-to-Real).
  • Robustness Benchmarks: CIFAR-10.1 and CIFAR-10-C, which contains 15 types of algorithmically simulated real-world corruptions (noise, blur, weather effects).

Key Insights and Results

  • Simplicity Wins: Simple consistency training with random augmentation—without any heavy "policy searching"—can achieve results that rival or beat much more complex, specialized DA/DG algorithms.
  • Differentiability is Key: By focusing on a subset of transformations that are differentiable (via STNs), the authors bypassed the need for expensive reinforcement learning or evolution strategies.
  • Unified Framework: The same underlying logic (consistency + adversarial geometry) works for both DA and DG, suggesting that the "domain shift" problem is fundamentally about learning transformation-invariant features.
  • State-of-the-Art Performance: On the PACS dataset, the method achieved an average accuracy of 92.28% for multi-source DA (ResNet-18). On Office-Home, it reached 67.6% average accuracy for unsupervised DA. On VisDA, it outperformed the popular CDAN+E method by 2.6%.
  • Robustness Correlation: Models that generalize well to new domains also tend to be more robust to pixel-level corruptions (like fog or frost), even if those specific corruptions weren't seen during training.

Limitations and Future Work

The adversarial part of the model (the STN) is limited to affine geometric transformations and cannot currently "learn" to create adversarial color shifts or non-linear distortions (like motion blur) because those operations are often non-differentiable. Additionally, the weights for the consistency loss and adversarial loss require careful tuning. Future work aims to extend the differentiable adversarial framework to include more complex, non-affine transformations.

Summary updated

BibTeX
@misc{xiao2022adversarial,
  author = {Liang Xiao and Jiaolong Xu and Dawei Zhao and Er-Ke Shang and Qi Zhu and Bin Dai},
  title = {{Adversarial and Random Transformations for Robust Domain Adaptation and Generalization}},
  year = {2022},
  eprint = {2211.06788},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.06788},
}
Figure