TL;DR
This paper introduces "Test-Time Style Shifting" (TS) and "Style Balancing" (SB) to improve domain generalization (DG) performance, especially when target domains have significantly different styles from training domains. TS shifts test sample styles to the closest known source domain style at inference time, while SB balances style diversity during training to better prepare models for unseen styles.
What Problem Does This Paper Address?
Domain generalization (DG) aims to train models that perform well on unseen target domains without any further training or adaptation. A major challenge in DG is the "domain shift," where the statistical properties (or "style") of data in the target domain differ significantly from the training domains. This is particularly problematic when the target domain's style is drastically different from any of the training domains, leading to poor performance. Existing DG methods often struggle with such large style gaps, and can also be hampered by imbalanced data distributions across domains and classes. This paper tackles the problem of handling arbitrary target domain styles, especially those with a large discrepancy from the source domains, and also addresses DG-specific class imbalance issues.
Methods
The paper proposes two main techniques:
- Test-Time Style Shifting (TS): At inference time, for each test sample, TS analyzes its feature-level style statistics. If the style gap between the test sample and the known source domains is large (quantified by a threshold $\alpha$), the test sample's style is shifted to match the style of the "nearest" source domain. This is achieved using Adaptive Instance Normalization (AdaIN). If the style gap is small, the original style is preserved. This approach avoids any model updates at test time, making it computationally efficient.
- Style Balancing (SB): This is a training-time technique designed to mitigate DG-specific class imbalance issues and improve the effectiveness of TS. SB aims to balance the number of samples for each class across all source domains. It strategically selects samples from domains with an excess of a particular class and shifts their styles to domains that have fewer samples of that class. The selection process prioritizes samples with similar style statistics to minimize disruption. This process enhances domain diversity per class during training, making the model more robust to unseen styles and imbalanced data.
Datasets
The authors evaluate their methods on several standard DG benchmarks:
- PACS: Contains four domains: Art, Cartoon, Photo, and Sketch. The Sketch domain is noted for having a large style gap.
- VLCS: Contains four domains: Caltech, LabelMe, Pascal, and Sun.
- Office-Home: Contains four domains: Art, Clipart, Product, and Real-world.
- Market1501 and GRID: Used for instance retrieval tasks (person re-identification).
- DomainNet: A larger dataset with six domains and 345 classes.
The paper also considers imbalanced versions of PACS and VLCS, specifically cross-domain data imbalance and cross-domain class imbalance scenarios.
Key Insights and Ideas
- Style statistics are crucial for DG: The paper builds on the observation that feature statistics in early CNN layers capture style information, which is highly correlated with domain characteristics.
- Test-time adaptation can be style-centric: Instead of adapting model parameters, adapting the style of test samples at inference time can effectively bridge domain gaps.
- Handling large style gaps is key: The proposed TS method specifically targets test samples with styles far from any source domain, suggesting that a simple "shift to nearest" strategy is effective.
- Training-time style balancing complements test-time shifting: SB addresses class imbalance and improves overall domain diversity, creating a better foundation for TS to work effectively.
- Orthogonality of proposed methods: SB and TS are designed to be compatible with various existing DG techniques, including style augmentation, meta-learning, and domain alignment.
Key Results
- Significant improvements on PACS: The proposed TSB (Test-Time Style Shifting + Style Balancing) method, when combined with state-of-the-art DG techniques like MixStyle and EFDMix, consistently achieves higher average accuracy on the PACS dataset, particularly on the challenging Sketch domain. For example, TSB + EFDMix achieves 85.00% average accuracy on PACS, outperforming the baseline EFDMix (83.60%).
- Effectiveness on imbalanced datasets: SB significantly boosts performance on imbalanced PACS and VLCS datasets, especially in cross-domain class imbalance scenarios where traditional class-imbalanced learning methods fail.
- Strong performance on other benchmarks: TSB also shows improvements on VLCS, Office-Home, and instance retrieval tasks.
- Efficiency: TS requires no model updates at test time, making it computationally efficient compared to other test-time adaptation methods.
Limitations and Future Work
- Hyperparameter sensitivity: The paper mentions the hyperparameter $\alpha$ in TS, which controls the style shift threshold. While experiments show that various values of $\alpha$ still yield performance gains, finding the optimal $\alpha$ for different setups might require further investigation.
- Domain labels for TS: While the paper explores using pseudo domain labels for TS, the primary formulation relies on known source domain statistics. Future work could explore more robust ways to handle scenarios where source domain information is less structured or completely unavailable.
- Generalization to unseen domains with novel styles: While TS aims to handle arbitrary styles, its effectiveness is still tied to the diversity of styles present in the source domains. Handling entirely novel styles not represented in any form in the source domains might require further advancements.
- Further exploration of SB: The paper demonstrates SB's effectiveness in balancing style diversity and handling class imbalance. Further research could explore its application in more complex imbalance scenarios or its interaction with other data augmentation strategies.
Summary updated