Abstract
Deep learning models achieve high accuracy in segmentation tasks, yet domain shift often degrades performance in real-world scenarios where target-domain images are unavailable. This paper proposes ZoDi (Zero-shot Domain adaptation with Diffusion), a novel framework for zero-shot domain adaptation (ZSDA). ZoDi utilizes off-the-shelf diffusion models to synthesize target-like images by transferring source images to the target domain while maintaining layout and content through stochastic inversion. The model is then trained using both source and synthesized images, maximizing feature similarity to learn domain-robust representations. Experiments demonstrate that ZoDi outperforms state-of-the-art methods in image segmentation, offers backbone-agnostic flexibility, and enables performance estimation through visual inspection of generated images.
Introduction
Deep learning models for computer vision are notoriously brittle when faced with "domain shift"—the performance drop that occurs when a model trained on clear-weather data is deployed in rain, fog, or snow. While Unsupervised Domain Adaptation (UDA) helps bridge this gap by using unlabeled images from the target domain, real-world scenarios often provide zero target images during the training phase.
Existing Zero-Shot Domain Adaptation (ZSDA) methods typically rely on vision-language models like CLIP. However, CLIP-based methods have two major drawbacks: they usually require freezing the image backbone (limiting architectural choices) and they operate in an abstract feature space, making it impossible for a human to "see" what the model is actually learning. ZoDi addresses these issues by generating high-fidelity synthetic training data that is both interpretable and compatible with any model architecture.
Methodology
ZoDi tackles ZSDA through a two-stage pipeline: Zero-Shot Image Transfer and Model Adaptation.
1. Zero-Shot Image Transfer
The framework uses an off-the-shelf diffusion model (specifically ControlNet) to transform source images (e.g., Cityscapes) into the target domain (e.g., "driving in snow").
- Layout Preservation: The original segmentation maps are used as "layouts" for ControlNet to ensure the geometry of the scene remains identical between the source and the synthetic target.
- Content Preservation: To prevent the diffusion model from hallucinating new objects or losing fine details, ZoDi employs Stochastic Inversion. This technique adapts the initial noise used in the diffusion process to better reflect the original image's specific content, ensuring that a specific car in the source image remains the same car in the synthetic snowy version.
2. Model Adaptation
Once the synthetic "target-like" images are generated, the segmentation model is trained using a dual-loss approach:
- Task Loss ($\mathcal{L}_{task}$): Standard cross-entropy loss using the original segmentation labels, which remain valid due to the preserved layout.
- Similarity Loss ($\mathcal{L}_{sim}$): A cosine similarity constraint that forces the model to extract similar features from both the original source image and its synthetic target counterpart. This encourages the model to learn domain-invariant representations.
Experimental Results
Datasets and Setup
The authors evaluated ZoDi using Cityscapes (clear weather) as the source domain. Target domains included ACDC (real-world images in Night, Snow, Rain, and Fog) and GTA5 (synthetic-to-real shift). The method was tested across various backbones, including ResNet-50 and ResNet-101, with DeepLabv3+ and RefineNet decoders.
Performance Comparison
- Outperforming UDA: Surprisingly, ZoDi outperformed DAFormer (a strong unsupervised baseline) in "Clear → Snow" (+1.8 mIoU) and "Clear → Rain" (+4.5 mIoU) settings, despite DAFormer having access to 400 real target images while ZoDi had none.
- State-of-the-Art ZSDA: ZoDi significantly outperformed the CLIP-based PØDA in three out of five scenarios, particularly in Snow (45.6 vs 43.9 mIoU) and Fog (56.1 vs 49.0 mIoU).
- Consistency: Across all adverse weather tests, ZoDi provided a consistent boost over "Source-only" models, such as a +4.8 mIoU jump in snowy conditions.
Discussion and Insights
The "Seeable" Advantage
Unlike CLIP-based ZSDA, ZoDi generates actual images. This allows engineers to visually inspect the training data to estimate model performance before deployment. If the generated snow looks unrealistic or the diffusion model introduces artifacts, the model's performance will likely suffer, providing a level of transparency missing from feature-space methods.
Backbone Agnosticism
Because ZoDi generates a dataset rather than modifying the internal feature space of a specific model, it acts as a "plug-and-play" method. This flexibility allows it to be used with any segmentation architecture without the need to freeze specific layers.
Limitations
ZoDi struggles with extreme domain shifts, such as "Day → Night" transitions, where the diffusion model may fail to darken the image sufficiently while keeping content recognizable. Additionally, as with all generative models, there is a risk of "hallucinations" (e.g., turning a car into a truck), which can introduce noise during the training process.
Conclusion
ZoDi represents a significant step forward in Zero-Shot Domain Adaptation by leveraging the generative power of diffusion models. By maintaining layout and content through stochastic inversion, it creates high-quality synthetic datasets that allow models to generalize to unseen environments effectively. Its backbone-agnostic nature and visual interpretability make it a practical tool for deploying robust vision models in unpredictable real-world conditions.
Summary updated