Vision Transformer-based Adversarial Domain Adaptation

Yuan Wu, Yahan Li, Yuan Wu 0002arXiv 2024 · DOI

Vision Transformer-based Adversarial Domain Adaptation (VT-ADA)

Abstract

Unsupervised Domain Adaptation (UDA) aims to mitigate the performance drop caused by distribution shifts between source and target domains. While Adversarial Domain Adaptation (ADA) has traditionally relied on Convolutional Neural Networks (CNNs) for feature extraction, this paper explores the potential of Vision Transformers (ViTs). We introduce VT-ADA, a framework that replaces standard CNN backbones with ViTs to leverage global context modeling. Our results demonstrate that ViT-based models significantly outperform CNN-based counterparts in both accuracy and convergence speed across multiple benchmarks.

Introduction

The domain shift problem is a fundamental challenge in machine learning, where models trained on a labeled source domain often fail to generalize to an unlabeled target domain. UDA techniques, particularly ADA, address this by learning domain-invariant features through a minimax game between a feature extractor and a domain discriminator. Historically, ResNet-based CNNs have been the standard feature extractors. However, CNNs are limited by their local receptive fields. This study investigates whether the global self-attention mechanism of Vision Transformers can provide more robust features for domain adaptation.

Methodology

VT-ADA is a "plug-and-play" enhancement for existing ADA frameworks like DANN (Domain-Adversarial Neural Networks) and CDAN (Conditional Domain Adversarial Network). The primary modification involves replacing the standard ResNet backbone with a ViT-Base (ViT-B/16) model pre-trained on ImageNet-21K. By utilizing multi-head self-attention, the feature extractor captures long-range dependencies across the entire image, facilitating the learning of features that are both discriminative for classification and transferable across domains. The training follows the standard adversarial objective: the discriminator attempts to distinguish between source and target features, while the extractor is optimized to minimize classification loss on the source domain and maximize the discriminator's uncertainty.

Experimental Results

The framework was evaluated on three major benchmarks: Office-31, ImageCLEF, and Office-Home. VT-ADA consistently achieved state-of-the-art performance. For instance, on the challenging Office-Home dataset, VT-ADA improved DANN's accuracy by 16.9% and CDAN's by 15.2%. The VT-ADA (CDAN) variant reached an average accuracy of 91.5% on Office-31, surpassing several specialized domain adaptation transformers.

Convergence and Efficiency

Beyond final accuracy, VT-ADA exhibits superior training dynamics. As shown in Figure 2, the ViT-based approach converges significantly faster and reaches higher stability earlier in the training process compared to CNN-based methods like DANN and CDAN.

Accuracy vs. Iterations for different ADA methods. VT-ADA (pink) shows superior performance and faster convergence.

Feature Visualization

To understand the quality of the learned features, the authors employed t-SNE visualizations to project high-dimensional features into 2D space. Figure 1 compares the feature distributions of standard ADA methods against VT-ADA. The ViT-based model produces tighter, more distinct class clusters with significantly better overlap between source and target domains, indicating superior domain alignment and the successful learning of domain-invariant features.

t-SNE visualizations comparing DANN, CDAN, CDAN+E, and VT-ADA(CDAN). VT-ADA shows the most effective domain alignment.

Conclusion

VT-ADA demonstrates that the architectural shift from CNNs to Vision Transformers is a highly effective strategy for Unsupervised Domain Adaptation. The inherent ability of ViTs to model global context leads to more transferable and discriminative features, resulting in substantial performance gains and improved training efficiency. Future work will explore the scalability of this approach with larger Transformer models and its computational trade-offs.

Summary updated

BibTeX
@misc{wu2024vision,
  author = {Yuan Wu and Yahan Li and Yuan Wu},
  title = {{Vision Transformer-based Adversarial Domain Adaptation}},
  year = {2024},
  eprint = {2404.15817},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2404.15817},
}
Figure