Mind the Gap: Domain Gap Control for Single Shot Domain Adaptation for Generative Adversarial Networks

Peihao Zhu, Rameen Abdal, John Femiani, Peter Wonka

TL;DR

Adapting a pre-trained StyleGAN to a completely new visual domain using just a single reference image typically causes severe overfitting and mode collapse. This paper presents a framework that models the domain gap as a directional shift between an inverted counterpart in the source domain and the target reference image, coupled with within-domain consistency regularizers and latent style mixing. The result is high-fidelity, one-shot domain adaptation that preserves source identity and enables semantic image editing without retraining downstream editing tools.

What Problem Does This Paper Address?

Generative Adversarial Networks (GANs) like StyleGAN generate photorealistic imagery, but collecting thousands of images to train them on niche or artistic domains is prohibitive. Single-shot domain adaptation aims to fine-tune a pre-trained generator ($G_A$) to a target domain ($B$) using only a single reference image ($I_B$).

Existing approaches—such as StyleGAN-NADA—measure the target domain shift from the average image of the source domain in CLIP embedding space. In practice, this crude approximation leads to severe mode collapse: generated samples forfeit the identity, pose, and fine attributes of the source domain, all collapsing into near-duplicates of the reference image. The challenge lies in steering the generator into the new domain's visual style while preserving the diverse content, identity, and semantic manifold of the source domain.

Methods

The authors fine-tune a pre-trained StyleGAN2 generator into a new generator $G_B$ guided by a pre-trained CLIP image encoder ($E_I$):

  1. Inverse Transfer via II2S Embedding: Instead of taking a domain-wide mean, the target image $I_B$ is inverted into source domain $A$ using Improved-Image2StyleGAN (II2S) with strong latent regularization ($\lambda = 0.01$). This yields a source analog $I_A = G_A(w^{\text{ref}})$ that shares within-domain attributes (e.g., identity, pose) with $I_B$.
  2. Domain-Gap Vector: The cross-domain shift is modeled precisely as $v^{\text{ref}} = E_I(I_B) - E_I(I_A)$.
  3. Multi-Objective Refinement Losses:
  4. Cross-Domain Directional Loss ($\mathcal{L}_{\text{clip\_across}}$): Aligns the sample shift vector $v^{\text{samp}} = E_I(G_B(w)) - E_I(G_A(w))$ parallel to $v^{\text{ref}}$ via cosine similarity.
  5. Within-Domain Preservation Loss ($\mathcal{L}_{\text{clip\_within}}$): Ensures intra-domain variations are preserved, forcing the vector between any sample and the reference in domain $A$ to match the corresponding vector in domain $B$.
  6. Reference Preservation Losses ($\mathcal{L}_{\text{ref\_clip}}$ and $\mathcal{L}_{\text{ref\_rec}}$): Directly aligns $G_B(w^{\text{ref}})$ to $I_B$ using both CLIP cosine similarity and a visual reconstruction loss ($\text{LPIPS} + L_2$) to retain visual details like symmetry that CLIP embeddings miss.
  7. Style Mixing / Interpolation: In $\mathcal{W}+$ space, content is captured in early layers (first $m=7$ blocks) while style resides in deeper layers. The style blocks are linearly interpolated using a weight $\alpha \in [0, 1]$, granting explicit, continuous control over how aggressively the reference style is applied.

Datasets

The authors evaluate their framework using:

  • Pre-trained StyleGAN2 Models: Pre-trained on FFHQ (human faces), cars, cats, and dogs.
  • Target References & Datasets: Single artistic references (paintings, cartoons, sketches, Pixar characters, Avatar characters, etc.) and a full sketch dataset for quantitative evaluation.

Key Insights and Ideas

  • Anchored Domain Shift: Measuring domain shift from a specific inverted counterpart ($I_A$) rather than the domain mean isolates domain-level stylistic changes from instance-level attributes (like identity and pose).
  • Conserving Within-Domain Dynamics: Minimizing $1 - \text{sim}(v_A, v_B)$ ensures that moving away from the reference in domain $A$ produces an equivalent semantic shift in domain $B$, directly mitigating mode collapse.
  • Combining Semantic and Pixel Guidance: CLIP captures high-level style concepts, but fails at pixel symmetry and precise structural alignment; adding perceptual (LPIPS) and pixel ($L_2$) losses anchors the reference reconstruction visually.
  • Zero-Retraining Downstream Editing: Because the $\mathcal{W}+$ latent geometry is retained, existing latent-space manipulation frameworks (such as StyleFlow) work off-the-shelf on the newly adapted generator.

Key Results

  • Quantitative Performance (Sketch Domain):
  • FID $\downarrow$: Drops to 78.35, significantly outperforming StyleGAN-NADA (124.55) and the few-shot method by Ojha et al. (158.86).
  • Precision $\uparrow$: Achieves 0.33 (vs. 0.12 for StyleGAN-NADA and 0.00 for Ojha et al.).
  • Recall $\uparrow$: Achieves 0.02, representing the only evaluated method with non-zero recall at two decimal places.
  • User Study:
  • Quality: 73% and 77% of users preferred this method over StyleGAN-NADA and Ojha et al., respectively.
  • Identity Preservation: 80% and 91% preferred this method's source similarity over StyleGAN-NADA and Ojha et al.
  • Efficiency: Training requires only ~15 minutes (600 iterations, batch size 4) on a single Nvidia Titan XP GPU. Inference takes 0.34s per image, and fast encoders like e4e can invert real images for editing in 0.22s.

Limitations and Future Work

  • Semantic Alignment During Inversion: The initial II2S inversion does not explicitly constrain semantic similarity between $I_B$ and $I_A$, which can occasionally degrade source identity.
  • Restricted to Related Domains: The method requires source and target domains to share high-level geometric structures (e.g., human faces to stylized human portraits); adapting between distant categories (e.g., faces to cars) is not supported.
  • Pose Sensitivity: StyleGAN relies heavily on canonical alignments. Extreme poses or unaligned reference images can cause the inversion and subsequent domain adaptation to fail.

Summary updated

BibTeX
@inproceedings{zhu2022mind,
  author = {Peihao Zhu and Rameen Abdal and John Femiani and Peter Wonka},
  title = {{Mind the Gap: Domain Gap Control for Single Shot Domain Adaptation for Generative Adversarial Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=vqGi8Kp0wM},
}
Figure