Abstract
STYLIP is a novel prompt-learning framework designed to help CLIP-based models generalize to unseen domains (e.g., recognizing a "sketch" of a dog when trained only on "photos"). By extracting multi-scale style and content features directly from CLIP’s vision encoder to condition its prompts, STYLIP achieves state-of-the-art performance across multiple Domain Generalization (DG) benchmarks with minimal parameter overhead. This approach effectively disentangles object content from visual style, allowing for robust inference without manual domain labels.
Introduction
While large-scale foundation models like CLIP show incredible zero-shot capabilities, they often stumble when faced with domain shift—significant variations in visual style (like lighting, texture, or artistic medium) between training and testing data.
Existing solutions like "Prompt Tuning" (e.g., CoOp or CoCoOp) attempt to learn optimal text inputs for CLIP. However, these methods often overfit to the specific "style" of the training data, struggling to disentangle the content (what the object is) from the style (how the object is rendered). Furthermore, many domain generalization techniques require explicit domain labels (e.g., "this is a cartoon"), which are rarely available in real-world inference scenarios.
Methods
The authors propose STYLIP, which treats CLIP’s frozen vision encoder as a feature extractor for both style and content to dynamically "condition" the text prompts.
- Multi-Scale Style Extraction: Inspired by neural style transfer, the model calculates the channel-wise mean and standard deviation of feature maps from multiple layers of the vision encoder. These statistics act as a signature for the image's domain.
- Style Projectors ($P_m$): A set of lightweight networks maps these style statistics into specific prompt tokens. This ensures the prompt is "aware" of the visual domain of the input image.
- Content Projector ($P_C$): To prevent the model from ignoring the actual object, STYLIP aggregates multi-scale visual features (after dimensionality reduction via bottleneck layers) to provide a "content" context.
- Fusion Projector ($P_A$): This final component merges the style-conditioned prompt embeddings with the aggregated content features to generate the final classification weights.
- Contrastive Training: The entire projector suite is trained using a contrastive loss, maximizing the similarity between the generated prompt and the image's global feature vector while keeping the core CLIP encoders frozen.
Datasets and Evaluation
The authors evaluated STYLIP on a comprehensive suite of Domain Generalization benchmarks:
- Multi-Source & Single-Source DG: PACS (Photos, Art, Cartoons, Sketches), VLCS, Office-Home, Digits-DG, and the massive DomainNet.
- Cross-Dataset Generalization: Training on ImageNet and testing on 10 diverse datasets (e.g., EuroSAT for satellite imagery, DTD for textures).
- Base-to-Novel Class Generalization: Testing the model's ability to recognize entirely new categories in unseen domains.
Key Results
STYLIP consistently outperformed competitors like CoOp, CoCoOp, and MaPLe. On the challenging DomainNet dataset, it surpassed the previous best prompting techniques by a substantial margin.
- State-of-the-Art Performance: As shown in the comparative analysis, STYLIP achieves the highest average leave-one-out accuracy across different backbone configurations (e.g., 62.02% vs. MaPLe's 60.43%).
- Robustness to Domain Shift: In single-source DG settings, STYLIP showed improvements of 1.4% to 2.5% over existing SOTA methods.
- Base-to-Novel Success: In the "Base-to-Novel" setting, STYLIP achieved a higher Harmonic Mean (HM) score (79.41%) than MaPLe (78.55%), proving it generalizes to new classes better than previous multi-modal prompt learners.
- Efficiency: Despite the performance gains, STYLIP is extremely lightweight, adding only about 0.18% more parameters than standard prompt tuning methods.
Key Insights
- Style is in the Statistics: The paper reinforces the idea that low-to-mid-level feature statistics (mean/std) are excellent proxies for "style" and "domain," allowing the model to adapt without needing manual domain labels.
- Multi-Scale Matters: Semantics are usually found in deep layers, but style (textures, edges) is often captured in shallower layers. By using a multi-scale approach, STYLIP captures a more holistic representation of the image.
- Disentanglement is Key: By explicitly conditioning prompts on both style and content, the model avoids the "shortcut learning" where it might associate a specific artistic style with a specific object class.
Limitations and Future Work
STYLIP’s performance is inherently tied to the quality of the frozen CLIP vision encoder. If the encoder hasn't seen a specific type of feature during its massive pre-training, the projectors may have less to work with. Additionally, the authors noted that excessively long prompt context lengths can eventually lead to performance degradation. Future directions include extending this style-conditioned approach to other foundation models and exploring its utility in structured prediction tasks like object detection or segmentation.
Summary updated