TempT (Temporal consistency for Test-time adaptation) is a novel method that improves video-based facial expression recognition (FER) by fine-tuning models dynamically during inference. By leveraging temporal coherence—the principle that human emotions typically evolve smoothly rather than fluctuating frame-by-frame—as a self-supervision signal, TempT enhances accuracy and drastically reduces prediction "flicker" without requiring manual labels for the test data.
The Challenge of Domain Shift in Video
Machine learning models frequently encounter domain shift, where a model trained on high-quality studio images underperforms on real-world data, such as grainy webcam feeds. In Facial Expression Recognition (FER), this discrepancy is a significant barrier to deploying robust systems for applications like driver monitoring or therapeutic aids.
While Test-Time Adaptation (TTA) attempts to mitigate this by updating the model using unlabeled inference data, most TTA methods treat data points as independent and identically distributed (i.i.d.). Video data, however, is inherently sequential and highly correlated. Standard 2D CNNs often ignore this temporal context, resulting in "flickering" predictions where a subject's expression appears to jump erratically between categories (e.g., from Neutral to Anger and back) due to minor noise or lighting variations.
The TempT Methodology
TempT treats each video as a unique "domain" and adapts the model using a self-supervised temporal signal.
- Temporal Coherence as Supervision: The core hypothesis is that consecutive frames should yield similar predictions. Minimizing the variance between adjacent frames acts as a form of regularization, helping the model converge to more robust, "flatter" minima.
- The Median Filter Target: Rather than simply comparing frame $t$ to frame $t-1$, TempT passes raw model outputs through a Low-Pass Filter (specifically a Median Filter). This smoothed signal serves as a pseudo-ground truth. The model is updated by minimizing the Mean Squared Error (MSE) between its raw output and this filtered version.
- Selective Parameter Updates: To maintain generalizability and prevent catastrophic forgetting, TempT only updates the weight and bias terms in the Batch Normalization (BN) layers. All other parameters remain frozen.
- Smart Batching: For efficiency, the algorithm employs a sliding window to identify video segments with high "flicker" (frequent prediction changes), prioritizing these regions for adaptation batches.
Experimental Setup
The researchers evaluated TempT using three major FER datasets:
- AffWild2: The primary evaluation set, featuring over 500 videos captured in diverse, real-world conditions.
- Affectnet & RAF-DB: Used for large-scale pretraining to establish a robust base model before adaptation.
Key Insights
- Smoothing as a Teacher: Using a median filter to generate a supervision signal is a key innovation. Because median filters are robust to outliers, they effectively ignore momentary artifacts caused by poor cropping or sensor noise, teaching the model to ignore its own transient errors.
- TTA Challenges: Interestingly, the authors found that TENT, a popular entropy-minimization TTA method, actually degraded performance on video data. TENT struggles with the high correlation of video frames, whereas TempT is designed to exploit it.
- Efficiency vs. Scale: A smaller ResNet-18 model using TempT can match the performance of a much larger, static SE-ResNext-101 model, suggesting that dynamic adaptation can be more effective than simply increasing model parameters.
Results and Performance
TempT was evaluated on the AffWild2 validation set using the F1 Score:
- Accuracy Improvements: For a ResNet-18, the F1 score improved from 0.307 to 0.323. For the larger SE-ResNext-101, it rose from 0.325 to 0.345.
- Stability: Quantitatively, TempT reduced the normalized number of decision changes (emotion flips) from 0.15 to 0.043 per frame.
Qualitatively, visualizations demonstrate that confidence scores (logits) become significantly smoother after adaptation, ensuring predictions remain consistent over logical time intervals.
Limitations and Future Work
- Stochasticity: Adaptation performance can vary based on the random sampling of frames for training batches. Future work may involve more deterministic sampling strategies.
- Computational Cost: While updating only BN layers is efficient, backpropagation during inference increases compute requirements compared to a standard forward pass.
- Edge Deployment: TempT is a strong candidate for privacy-preserving edge deployment (e.g., on smartphones), though further optimization is needed for low-power hardware.
Summary updated