One-Shot Adaptation of GAN in Just One CLIP

Gihyun Kwon, Jong Chul Ye

TL;DR

This paper introduces a novel framework for adapting a pre-trained Generative Adversarial Network (GAN) to a new domain using only a single target image. By leveraging the semantic embedding space of CLIP, the authors successfully transfer complex textures and styles while preserving the structural integrity and diversity of the original model.

What Problem Does This Paper Address?

Fine-tuning a GAN (like StyleGAN) to generate images in a new style usually requires a large dataset. When researchers try to do this with just one image—a task called one-shot adaptation—they run into two major walls:

  1. Overfitting: The model "memorizes" the single target image, losing the ability to generate diverse outputs.
  2. Underfitting: The model fails to capture the intricate textures or semantic essence of the target domain, only changing superficial features like global color.

Existing methods often rely on pixel-wise similarity, which fails when the target style (e.g., an abstract sketch) is visually very different from the source domain (e.g., realistic photos).

Methods

The authors propose a two-step strategy entirely unified within the CLIP (Contrastive Language-Image Pre-training) embedding space. CLIP is a model trained to understand the relationship between text and images, and its internal "understanding" of images proves to be a powerful tool for style transfer.

Before fine-tuning, the model needs a starting point. The authors search the source GAN's latent space to find a "reference image" ($I_{ref}$) that most closely matches the semantic attributes of the target image ($I_{trg}$). Unlike previous methods that used pixel-wise loss, this search uses CLIP space similarity, which is much better at finding a structural match even if the styles are worlds apart.

Step 2: Generative Model Fine-tuning

Once a reference is found, the generator is fine-tuned using three key novel components:

  • Cross-domain Semantic Consistency: This ensures that if two images were "close" in the source GAN's CLIP space, their adapted versions remain "close" in the target GAN's CLIP space. This preserves the original model's diversity.
  • Patch-wise Semantic Consistency: To maintain fine spatial details, the authors apply contrastive learning to small patches of the images. By ensuring local patches in the adapted image correspond to the same locations in the source image within CLIP space, they prevent the model from deforming the content too much.
  • Reference Target Alignment: The specific reference image found in Step 1 is explicitly forced to match the target image's style and texture.
Fig. 4: (a) Patch-wise semantic consistency in the CLIP space. We crop the patches from generated images and embed the cropped patches using a pre-trained CLIP model. Then we apply contrastive learning on those embedded vectors. (b) Reference target alignment. In the case of using reference latent wref, the generated image should match Itrg.

Datasets

The authors evaluated their method using several high-quality pre-trained models and diverse target domains:

  • Source Models: StyleGAN2 pre-trained on FFHQ (faces), LSUN Church, LSUN Cars, and AFHQ Dog.
  • Target Domains: Portrait art, watercolor paintings, oil paintings, lions, sketches, sunglasses, and babies.
  • Benchmarks: They compared against state-of-the-art baselines including StyleGAN-NADA, Mind the Gap (MTG), and RSSA.

Key Insights and Ideas

  • CLIP as a Universal Semantic Bridge: The core "aha moment" is that CLIP's embedding space is robust enough to serve as a unified metric for both finding a reference image and maintaining consistency during training. It captures "what" is in the image better than raw pixels.
  • Patch-wise CLIP Embeddings: While CLIP is usually used for whole images, the authors found that applying it to patches is essential for preserving local structural details (like the shape of an eye or the grille of a car) during drastic style shifts.
  • Stability through $L_2$ Regression: Interestingly, they found that simple $L_2$ distance between CLIP similarity scores was more stable for training than more complex measures like KL divergence, which often led to training failure in the one-shot setting.

Key Results

The proposed method consistently outperformed baselines in both qualitative beauty and quantitative metrics.

  • Qualitative: As seen in Figure 1, the model successfully transforms realistic photos into diverse artistic styles while keeping the "identity" of the original subject intact.
  • Quantitative: The model achieved the best FID (Fréchet Inception Distance) scores on the Sketches and Sunglasses datasets, indicating higher image quality. It also scored highest in LPIPS (diversity) and Identity (ID) preservation scores, proving it doesn't just overfit to the target.
  • User Study: In a study involving 30 users, the proposed model was preferred over all baselines for its ability to reflect target style while matching source content.
Fig. 1: Various domain adaptation results from our model. Our model successfully fine-tuned the models pre-trained on large data into a target domain with only a single shot target image. The adapted model can generate various images corresponding to the target domain while preserving the content attribute of the source domain. More generated samples can be found in the experiment section.

Limitations and Future Work

The authors noted that generated images can sometimes have minor artifacts in the background. They mitigated this using a "style mixing trick" (replacing fine-layer style codes with an average vector), but it remains an area for improvement.

Looking forward, the team plans to extend this one-shot adaptation framework to natural image generative models beyond StyleGAN and explore its application in emerging architectures like diffusion models.

Summary updated

BibTeX
@article{kwon2023one,
  author = {Gihyun Kwon and Jong Chul Ye},
  title = {{One-Shot Adaptation of GAN in Just One CLIP}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2023},
  url = {https://openreview.net/forum?id=Zz65pYIH-d},
}
Figure