Abstract
Domain Generalization (DG) aims to train models that perform reliably on unseen target domains. While feature stylization techniques like MixStyle improve robustness by augmenting latent styles, they often inadvertently degrade the structural integrity of objects, hindering recognition in shape-dependent domains. This paper presents a structure-aware feature stylization framework that incorporates an auxiliary edge reconstruction task. By forcing the model to reconstruct image contours from stylized features, the encoder learns to prioritize invariant structural cues over volatile textures. Experimental results across five benchmarks, including PACS and DomainNet, demonstrate that this approach achieves state-of-the-art performance and significantly improves generalization to novel styles.
Introduction
Deep learning models typically operate under the assumption that training and testing data are independent and identically distributed (i.i.d.). However, real-world applications frequently encounter "domain shift," where the test distribution (e.g., sketches or cartoons) differs significantly from the training distribution (e.g., photos). Domain Generalization (DG) seeks to address this by learning domain-invariant representations. Recent "feature stylization" methods attempt to simulate domain shifts by mixing feature statistics. While effective, these methods can "scramble" the underlying geometry of objects. This paper argues that preserving structural information—the "skeleton" of an object—is crucial for robust generalization.
Methodology
The proposed framework utilizes a multi-task learning objective to balance classification accuracy with structural preservation. The architecture consists of three primary components: a feature extractor, a stylization block, and a lightweight decoder.
As shown in the architecture diagram above, the Feature Extractor (typically a ResNet backbone) processes the input image $x$. Within this pipeline, a Feature Stylization Block manipulates the mean and standard deviation of latent features to generate "hallucinated" styles. To ensure these manipulations do not destroy essential shapes, a Decoder is trained to reconstruct the original Canny edges of the input from these stylized features. The model is optimized using a joint loss: a standard cross-entropy loss ($\mathcal{L}_{ce}$) for classification and a Structural Consistency Loss ($\mathcal{L}_{sc}$) for edge reconstruction. Notably, the decoder is discarded after training, ensuring no additional computational overhead during inference.
Experimental Evaluation
The method was validated on five gold-standard DG benchmarks: PACS, VLCS, OfficeHome, DomainNet, and Digits-DG. On the PACS dataset, which features extreme stylistic shifts between photos, art, cartoons, and sketches, the model achieved an average accuracy of 86.11%, a significant improvement over the 79.94% baseline. Performance on the "Sketch" domain was particularly noteworthy, where the emphasis on structure led to a nearly 14% boost over the baseline. Similar gains were observed in Digits-DG, where the model reached 81.44% accuracy.
Analysis of Structural Consistency
The weight of the structural consistency loss, denoted by $\lambda$, plays a critical role in the model's ability to retain shape information.
As illustrated in the visual analysis, low values of $\lambda$ (e.g., 0.1) result in blurry, indistinct reconstructions, indicating that the encoder is losing structural detail during stylization. As $\lambda$ increases to 1.0, the reconstructed edges become sharp and faithful to the ground truth (GT), even when the underlying features have been heavily stylized. This confirms that the auxiliary task successfully regularizes the encoder to maintain a "universal language" of structure, preventing the model from overfitting to the specific textures of source domains.
Conclusion
By integrating edge reconstruction into the feature stylization process, this work provides a robust solution to the trade-off between style augmentation and structural preservation. The resulting models are less prone to overfitting to source-domain textures and more capable of recognizing objects based on their fundamental shapes. Future work may explore more complex structural priors, such as 3D geometry or semantic segmentation masks, to further enhance domain invariance.
Summary updated