Abstract
Test-Time Adaptation (TTA) methods improve the robustness of deep neural networks to domain shifts. This paper explores the adaptation of segmentation models to a single unlabeled image with no other data available at test time—a setting termed Single Image Test-Time Adaptation (SITTA). This approach allows for individual sample performance analysis while excluding orthogonal factors like weight restart strategies. We propose two new segmentation TTA methods and compare them to established baselines and recent state-of-the-art. Our analysis highlights that simple modifications, such as the choice of loss function, can significantly improve baseline performance. Furthermore, we find that different methods and hyperparameters are optimal for different kinds of domain shifts, posing a challenge for developing fully general methods.
Introduction
Deep learning models often struggle when encountering "domain shift"—variations in lighting, weather, or sensor noise between training and deployment. While standard Test-Time Adaptation (TTA) attempts to mitigate this by updating models on the fly, most methods rely on continuous data streams or large batches.
This work focuses on the more restrictive SITTA setting, characterized by:
- No Source Data: Training data is unavailable during adaptation.
- Single Sample: Adaptation occurs using only one image.
- No Temporal Stability: Unlike video, no assumptions are made about sequential image similarity.
SITTA is particularly challenging for segmentation due to class imbalances within a single frame (e.g., a small object against a large background), which can lead to unstable adaptation.
Proposed Methods
The paper introduces two novel approaches designed for the SITTA regime:
Mask Refinement (Ref)
The Mask Refinement method employs a small auxiliary "refiner" network (a U-Net) trained on the source domain. The refiner is trained to map "corrupted" or noisy segmentation masks back to clean, realistic ones. During inference, the main segmenter predicts a mask, which the refiner then "fixes." This refined mask serves as a high-quality pseudo-label to fine-tune the main model. To train the refiner without target domain data, the authors use adversarial attacks on source images to simulate realistic mask errors.
Deep-Intersection-over-Union (dIoU)
This method utilizes a module to predict a scalar quality score (the IoU) for a predicted mask. The model is then optimized at test time to maximize this predicted quality score.
The "IoU Loss" Trick
A key finding is that standard TTA often fails in SITTA because it relies on Cross-Entropy (CE) loss for pseudo-labeling. CE does not account for the extreme class imbalance present in single images. By switching to an IoU-based loss, the authors found that even simple baseline methods become significantly more stable and effective.
Experimental Evaluation
The methods were evaluated using a three-stage framework:
- Source Training: Models (DeepLabV2/V3) were pre-trained on GTA5 and COCO.
- Hyper-parameter Tuning: Conducted on synthetic corruptions (GTA5-C, COCO-C) involving 15 types of noise, blur, and weather effects.
- Real-world Testing: Validated on Cityscapes, ACDC (fog, rain, night, snow), and VOC.
Key Results and Insights
- Baseline Improvements: Replacing Cross-Entropy with IoU loss improved pseudo-labeling performance by 3.51% on GTA5-C and 3.28% on COCO-C.
- Refiner Efficacy: The Mask Refinement method proved most effective on "hard" images where initial performance was low. It acts as a structural prior, enforcing what a valid segmentation mask should look like regardless of input corruption.
- Robustness: On the ACDC-Snow dataset, the Ref method improved mIoU from 31.54% to 35.60%. It showed consistent improvements across diverse conditions like fog and night.
- SITTA Advantages: By resetting the model after every image, SITTA avoids "catastrophic forgetting" and "order dependency" issues common in continual TTA.
Conclusion and Future Work
While SITTA offers significant robustness gains, it introduces computational overhead because it requires gradient descent steps for every inference image. Future research should focus on improving efficiency, perhaps by selectively adapting only when a significant domain shift is detected. Additionally, exploring these methods on modern Vision Transformer (ViT) architectures remains an important next step.
Summary updated