Smoothing Matters: Momentum Transformer for Domain Adaptive Semantic Segmentation

Runfa Chen, Yu Rong, Shangmin Guo, Jiaqi Han, Fuchun Sun, Tingyang Xu, Wenbing HuangarXiv 2022 · DOI

Introduction

Unsupervised Domain Adaptation (UDA) is a critical task in semantic segmentation, aiming to bridge the "sim-to-real" gap. While Vision Transformers (ViTs) have set new benchmarks in supervised learning, they have historically struggled with UDA compared to traditional Convolutional Neural Networks (CNNs). This paper identifies the root cause as the "high-frequency component problem"—a phenomenon where ViT predictions and internal features fluctuate wildly during training, leading to unstable self-training.

The High-Frequency Component Problem

Standard UDA techniques, such as self-training with pseudo-labels, rely on the model acting as a stable teacher for itself. However, the authors observe that ViTs exhibit significant "zig-zag" learning dynamics. As shown in Figure 1, the predictions and features of a Swin-Transformer (green lines) vibrate drastically iteration-to-iteration compared to a ResNet-101 (blue lines). This high-frequency noise prevents the model from converging on a reliable target domain representation.

Visualizing the instability of ViTs vs. CNNs in UDA and the smoothing effect of momentum.

The TransDA Framework

To address this instability, the authors propose TransDA, a framework designed to smooth the learning signal for Transformers. TransDA introduces two core innovations: the Momentum Transformer and Dynamic Discrepancy Measurement.

1. Momentum Transformer as a Low-Pass Filter

Instead of generating pseudo-labels from the current, jittery model, TransDA maintains a "Momentum Network"—a temporal moving average of the main model's weights. This network acts as a low-pass filter, suppressing high-frequency fluctuations and providing a stable, "smoothed" supervision signal for both labels and features. The red lines in Figure 1 demonstrate how this mechanism effectively stabilizes the learning process.

2. Dynamic Discrepancy Measurement

TransDA further refines the alignment process by weighting target samples based on their quality. The weighting function ($w$) considers:

  • Uncertainty: Samples with high entropy (where the model is confused) are down-weighted.
  • Domain Similarity: A dedicated similarity network identifies target samples that most closely resemble the source domain, prioritizing them for initial alignment.
Overview of the TransDA architecture featuring the Segmentation Network and the Momentum Network.

Experimental Results

The researchers evaluated TransDA on standard benchmarks, including GTA5 $\to$ Cityscapes and SYNTHIA $\to$ Cityscapes.

  • State-of-the-Art Performance: TransDA-S (using a Swin-S backbone) achieved 60.6 mIoU on GTA5 $\to$ Cityscapes, significantly outperforming previous state-of-the-art methods like ProDA.
  • Ablation Insights: The momentum mechanism alone improved the baseline Swin-Transformer from 53.9 mIoU to 59.3 mIoU. Interestingly, while dynamic weighting significantly boosted ViT performance, it had negligible impact on CNNs, suggesting that ViTs are uniquely sensitive to the quality of the alignment signal.

Conclusion and Future Work

TransDA demonstrates that "smoothing" is a non-negotiable requirement for successfully applying Vision Transformers to unsupervised domain adaptation. By filtering out high-frequency noise through a momentum-based approach, TransDA enables ViTs to surpass CNN-based methods in sim-to-real transitions.

While momentum networks are more memory-efficient than maintaining massive lookup tables for pseudo-labels, they still require maintaining a second set of weights, which increases the training footprint. Future research may explore applying this smoothing philosophy to other unstable Transformer training paradigms, such as GANs, or investigating more complex domain discrepancy metrics.

Summary updated

Abstract

After the great success of Vision Transformer variants (ViTs) in computer vision, it has also demonstrated great potential in domain adaptive semantic segmentation. Unfortunately, straightforwardly applying local ViTs in domain adaptive semantic segmentation does not bring in expected improvement. We find that the pitfall of local ViTs is due to the severe high-frequency components generated during both the pseudo-label construction and features alignment for target domains. These high-frequency components make the training of local ViTs very unsmooth and hurt their transferability. In this paper, we introduce a low-pass filtering mechanism, momentum network, to smooth the learning dynamics of target domain features and pseudo labels. Furthermore, we propose a dynamic of discrepancy measurement to align the distributions in the source and target domains via dynamic weights to evaluate the importance of the samples. After tackling the above issues, extensive experiments on sim2real benchmarks show that the proposed method outperforms the state-of-the-art methods. Our codes are available at https://github.com/alpc91/TransDA
BibTeX
@misc{chen2022smoothing,
  author = {Runfa Chen and Yu Rong and Shangmin Guo and Jiaqi Han and Fuchun Sun and Tingyang Xu and Wenbing Huang},
  title = {{Smoothing Matters: Momentum Transformer for Domain Adaptive Semantic Segmentation}},
  year = {2022},
  eprint = {2203.07988},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.07988},
}
Figure