Continual Test-Time Domain Adaptation

Qin Wang, Olga Fink, Luc Van Gool, Dengxin Dai

Introduction

Standard test-time adaptation (TTA) methods are typically designed under the assumption that a model adapts from a source domain to a single, stationary target domain. However, real-world applications—such as autonomous driving—frequently encounter non-stationary environments where data distributions shift continually (e.g., from clear weather to rain, then to fog, and eventually to night). In these scenarios, traditional TTA methods often suffer from performance degradation over time. This paper introduces Continual Test-Time Adaptation (CoTTA), a framework designed to handle sequences of changing domains without requiring access to original source data.

The Challenges of Continual Adaptation

Existing TTA approaches, such as TENT, primarily focus on adapting to a fixed distribution. When applied to a continual stream of varying domains, they face two critical hurdles:

  1. Error Accumulation: In self-training regimes, models generate "pseudo-labels" for unlabeled test data. If the model makes incorrect predictions early on, these errors are reinforced during the update process, leading to a "death spiral" where the model's accuracy collapses over time.
  2. Catastrophic Forgetting: As a model specializes in a new environment (e.g., adapting to snowy conditions), it often loses the foundational features learned during its initial training on the source domain. This makes it less capable of handling previous environments or even new, unseen ones.

Methodology: The CoTTA Framework

CoTTA addresses these issues through two primary mechanisms that stabilize the adaptation process and preserve long-term knowledge.

1. Weight-and-Augmentation-Averaged Predictions

To mitigate error accumulation, CoTTA utilizes a "Mean Teacher" approach. Instead of the model learning directly from its own immediate (and potentially noisy) predictions, it uses a Teacher model—an Exponential Moving Average (EMA) of the Student model's weights.

To further refine the quality of pseudo-labels, CoTTA employs confidence-based data augmentation. If the model is uncertain about a specific input, it performs multiple random augmentations on that image and averages the resulting predictions. This ensemble-like approach provides more stable and accurate targets for the Student model to learn from, effectively slowing the propagation of errors.

2. Stochastic Restoration

To combat catastrophic forgetting, the authors introduce a "stochastic restoration" trick. During each iteration, a small fraction (e.g., 1%) of the model's weights are randomly reset to their original pre-trained values. This mechanism acts as a powerful regularizer, ensuring the model remains grounded in its original source knowledge. By preventing the weights from drifting too far from the foundational features, the model retains its ability to generalize across multiple domains even as it fine-tunes for the current one.

Unlike many previous methods that only update Batch Normalization layers to maintain stability, CoTTA's robust design allows for the fine-tuning of all internal parameters, unlocking the full capacity of the network for adaptation.

Experimental Evaluation

The researchers evaluated CoTTA across several rigorous benchmarks designed to simulate real-world environmental shifts:

  • Corrupted Classification (CIFAR10-C, CIFAR100-C, and ImageNet-C): Models were subjected to a sequence of 15 different corruption types (e.g., motion blur, snow, and various noises).
  • Dynamic Semantic Segmentation (Cityscapes-to-ACDC): A model trained on clear-weather city streets was tasked with adapting to a sequence of Fog, Night, Rain, and Snow. To test long-term stability, this sequence was repeated ten times.

Key Results and Insights

CoTTA demonstrated superior performance and stability compared to existing baselines:

  • Classification Accuracy: On CIFAR10-C, CoTTA reduced the average error rate to 16.2%, significantly outperforming standard Batch Normalization adaptation (20.4%) and TENT-continual (20.7%). On CIFAR100-C, it achieved a 32.5% error rate, a substantial improvement over the 46.2% seen with standard pseudo-labeling.
  • Segmentation Stability: In the Cityscapes-to-ACDC task, CoTTA maintained a high 58.6 mIoU. Crucially, while other methods saw their performance erode over multiple cycles of weather changes, CoTTA remained stable, proving its resilience to long-term environmental shifts.
  • Architectural Versatility: The method proved effective across diverse architectures, including traditional ResNets and modern Vision Transformers like Segformer.

Conclusion and Future Work

CoTTA represents a significant step forward in making test-time adaptation viable for the real world. By combining a Mean Teacher strategy with stochastic weight restoration, it effectively manages the trade-off between learning new information and preserving old knowledge.

However, these gains come with a computational trade-off. The use of multiple augmentations (up to 32 per step) and a dual-model setup increases the memory and compute requirements, which may be a constraint for edge devices. Future research may focus on optimizing the efficiency of these augmentations or developing more selective methods for weight restoration to further refine the balance between adaptation speed and foundational stability.

Summary updated

BibTeX
@inproceedings{wang2022continual,
  author = {Qin Wang and Olga Fink and Luc Van Gool and Dengxin Dai},
  title = {{Continual Test-Time Domain Adaptation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.00706},
}
Figure