Abstract
Existing test-time adaptation (TTA) methods often struggle when images face multiple, mixed corruptions, such as simultaneous blur and noise. This paper introduces CAFe (Covariance-Aware Feature alignment), a method that aligns the correlations between features—not just their mean and variance—using pre-computed source statistics and a feature grouping strategy to maintain numerical stability during online adaptation. CAFe significantly reduces the distribution gap and improves accuracy on benchmarks like ImageNet-C under heterogeneous shifts.
Introduction
Deep learning models are notoriously brittle when the data they see at test-time differs from their training data, a phenomenon known as distribution shift. While Test-Time Adaptation (TTA) allows a model to adjust to new environments without needing the original training labels, most existing techniques assume a single type of corruption (e.g., just fog or just pixelation). In real-world scenarios, such as autonomous driving, models often face a "mixed" cocktail of corruptions simultaneously. Standard TTA methods often leave a significant distribution gap under these conditions because they ignore the complex correlations between feature dimensions that shift when images are corrupted.
Methodology
CAFe (Covariance-Aware Feature alignment) aims to make the feature distribution of corrupted target data match the original source data distribution. The framework consists of four main components:
- Pre-computed Statistics: Before deployment, the mean and covariance of features are calculated on the clean source dataset to serve as a reference.
- Covariance Alignment: During testing, CAFe minimizes the KL-divergence between the target and source feature distributions, explicitly aligning covariance matrices to capture feature correlations.
- Feature Grouping: To handle high-dimensional features with small mini-batches, CAFe uses spectral clustering to divide features into smaller, highly-correlated groups. This ensures numerical stability for covariance estimation.
- Infomax Loss: An information maximization loss is added to encourage confident and diverse predictions, preventing class clusters from collapsing.
Experimental Setup
The researchers evaluated CAFe using standard corruption benchmarks: CIFAR-10-C, CIFAR-100-C, and ImageNet-C. To simulate realistic, heterogeneous environments, they created "Mixed" and "All-mixed" sets, combining different types and severity levels of noise, blur, and weather effects.
Key Results
CAFe consistently outperformed state-of-the-art baselines like Tent, BACS, and AdaBN, particularly in complex scenarios:
- ImageNet-C (All-mixed): CAFe achieved 48.55% accuracy, significantly higher than the next best baseline (Infomax at 46.52%) and far above the unadapted Source model (39.16%).
- CIFAR-100-C (Mixed): CAFe reached 40.01% accuracy, outperforming other methods which typically ranged between 34% and 39%.
- Stability: Feature grouping proved essential; without it, covariance-based alignment failed to converge due to numerical instability.
Key Insights
- Correlations are Vital: Standard Batch Normalization adaptation only fixes mean and variance. CAFe demonstrates that the relationship between features carries vital information distorted by noise.
- Divide and Conquer: Grouping features via spectral clustering transforms an impossible high-dimensional optimization problem into a series of stable, smaller ones.
- Closing the Gap: CAFe is significantly more effective at physically pulling the target feature distribution back toward the source distribution compared to traditional TTA methods.
Limitations and Future Work
CAFe's performance depends on the number of groups ($k$), which should be larger than the ratio of feature dimensions to batch size. Additionally, while source statistics are pre-computed, the group-wise KL-divergence and initial spectral clustering add some computational overhead. The method also assumes feature distributions are roughly Gaussian, which may not hold for all architectures. Future work could explore dynamic grouping or scaling this approach to larger foundation models.
Summary updated