Towards Unsupervised Domain Adaptation via Domain-Transformer

Chuan-Xian Ren, Yi-Ming Zhai, You-Wei Luo, Meng-Xue Li

Abstract

Unsupervised Domain Adaptation (UDA) is a critical task in machine learning aimed at transferring knowledge from a labeled source domain to an unlabeled target domain. This paper introduces the Domain-Transformer (DoT), a novel framework that utilizes domain-level cross-attention to align disparate feature spaces. By establishing a theoretical link between the attention mechanism and Optimal Transport (OT) theory, specifically barycentric mapping, DoT provides a robust, architecture-agnostic module for domain alignment. Our experiments demonstrate that DoT achieves state-of-the-art performance on major benchmarks such as VisDA-2017 and DomainNet, effectively mitigating domain shift without the risks associated with traditional pseudo-labeling.

Introduction

Deep learning models are notoriously sensitive to changes in data distribution, a phenomenon known as domain shift. For instance, a model trained on synthetic 3D renders of vehicles may perform poorly when deployed on real-world street imagery. Unsupervised Domain Adaptation (UDA) addresses this by leveraging labeled data from a source domain to improve performance on an unlabeled target domain.

Conceptual overview of domain shift and the adaptation process via locality consistency and transformation.

Traditional UDA methods often rely on pseudo-labeling, which can lead to error accumulation, or patch-level Transformers that ignore global cross-domain relationships. The Domain-Transformer (DoT) addresses these gaps by focusing on domain-level correspondences and manifold alignment, providing a "plug-and-play" module that can be integrated into standard architectures like ResNet or Vision Transformers (ViT).

The Domain-Transformer (DoT) Framework

The core of the proposed approach is the Domain-Transformer (DoT) module, which treats domain alignment as a feature transformation problem.

The Domain-Transformer (DoT) architecture, illustrating the flow from feature extraction to barycentric mapping and shared subspace alignment.

Domain-Level Cross-Attention

Unlike standard Transformers that compute self-attention within a single image, DoT computes cross-attention between the source and target domains. Source features ($F^s$) act as queries, while target features ($F^t$) serve as keys and values. This mechanism generates an attention matrix $A$ that represents the similarity between samples across domains. The source samples are then "transformed" into the target space ($\hat{F}^s$) as weighted combinations of target samples, effectively mapping the source distribution onto the target manifold.

Locality Preserving Projections (LPP)

To maintain the semantic structure of the data during transformation, DoT incorporates manifold regularization. By enforcing locality consistency, the model ensures that samples belonging to the same class in the source domain remain clustered together in the shared subspace after adaptation, preventing the "mushing" of distinct categories.

Theoretical Foundations: Attention as Optimal Transport

A key contribution of this work is the theoretical bridge between Transformers and Optimal Transport (OT). The authors prove that the softmax-based attention mechanism in DoT is mathematically equivalent to a barycentric mapping in OT. This interpretation moves the attention mechanism from a heuristic "black-box" to a geometrically interpretable solver that physically aligns data manifolds by minimizing the Wasserstein distance between distributions. This allows DoT to find sample correspondences naturally rather than forcing distribution-level alignment through metrics like MMD.

Experimental Evaluation

The DoT framework was evaluated on five standard UDA benchmarks, ranging from small-scale datasets like Office-31 to large-scale challenges like DomainNet.

  • VisDA-2017: On this synthetic-to-real challenge, DoT achieved 84.9% accuracy using a ResNet-101 backbone, significantly outperforming previous state-of-the-art methods like TPN (80.4%) and DMP (79.3%).
  • DomainNet: In the most demanding UDA benchmark (0.6 million images, 345 classes), DoT reached a mean accuracy of 52.7% with a ViT backbone, a substantial improvement over the 38.1% standard ViT baseline.
  • Efficiency: Analysis shows that DoT reduces the Wasserstein distance between domains more effectively than dedicated OT solvers like DeepJDOT, leading to tighter generalization bounds and better performance.

Conclusion

The Domain-Transformer (DoT) represents a significant step forward in UDA by providing a theoretically grounded method for domain alignment. By reframing attention as a form of Optimal Transport, the authors provide a powerful tool for capturing long-range correspondences between domains without the need for risky pseudo-labels. Future work will explore the application of DoT in meta-learning and open-set domain adaptation scenarios to further enhance model robustness in diverse environments.

Summary updated

BibTeX
@article{ren2024towards,
  author = {Chuan-Xian Ren and Yi-Ming Zhai and You-Wei Luo and Meng-Xue Li},
  title = {{Towards Unsupervised Domain Adaptation via Domain-Transformer}},
  journal = {Int. J. Comput. Vis.},
  year = {2024},
  doi = {10.1007/s11263-024-02174-9},
}
Figure