Code Monkey home page Code Monkey logo

dynagan's Introduction

DynaGAN: Dynamic Few-shot Adaptation of GANs to Multiple Domains
Official PyTorch Implementation of the SIGGRAPH Asia 2022 Paper

Teaser image 1 DynaGAN: Dynamic Few-shot Adaptation of GANs to Multiple Domains
Seongtae Kim, Kyoungkook Kang, Geonung Kim, Seung-Hwan Baek, Sunghyun Cho
arXiv ACM OpenProject Badge

Abstract: Few-shot domain adaptation to multiple domains aims to learn a complex image distribution across multiple domains from a few training images. A naïve solution here is to train a separate model for each domain using few-shot domain adaptation methods. Unfortunately, this approach mandates linearly-scaled computational resources both in memory and computation time and, more importantly, such separate models cannot exploit the shared knowledge between target domains. In this paper, we propose DynaGAN, a novel few-shot domain-adaptation method for multiple target domains. DynaGAN has an adaptation module, which is a hyper-network that dynamically adapts a pretrained GAN model into the multiple target domains. Hence, we can fully exploit the shared knowledge across target domains and avoid the linearly-scaled computational requirements. As it is still computationally challenging to adapt a large-size GAN model, we design our adaptation module light-weight using the rank-1 tensor decomposition. Lastly, we propose a contrastive-adaptation loss suitable for multi-domain few-shot adaptation. We validate the effectiveness of our method through extensive qualitative and quantitative evaluations.

Installation

Clone the repository:

git clone https://github.com/blueGorae/DynaGAN.git
cd DynaGAN

Dependencies:

All python dependencies for defining the environment are provided in ./environment/environment.yml.

conda env create -f environment/environment.yml

Download pretrained models

Download files under pretrained_models/.

Model Description
ffhq.pt StyleGAN model pretrained on FFHQ with 1024x1024 output resolution.
ffhq_PCA.npz PCA components of the pretrained StyleGAN(FFHQ) latent space.
ArcFace Pretrained face recognition model to calculate identity loss.
afhqcat.pt StyleGAN model pretrained on AFHQ_Cat with 512x512 output resolution.
afhqcat_PCA.npz PCA components of the pretrained StyleGAN(AFHQ_Cat) latent space.

Training

Before training your model, put target images in the target_data/raw_data/ directory and run

bash ./scripts/train.sh

Generating samples

To generate multiple domain image samples, run

bash ./scripts/generate.sh

The outputs will be stored in samples/.

Acknowledgments

This code is borrowed from MindtheGap.

Citation

@inproceedings{Kim2022DynaGAN,
    title     = {DynaGAN: Dynamic Few-shot Adaptation of GANs to Multiple Domains},
    author    = {Seongtae Kim and Kyoungkook Kang and Geonung Kim and Seung-Hwan Baek and Sunghyun Cho},
    booktitle = {Proceedings of the ACM (SIGGRAPH Asia)},
    year      = {2022}
}

dynagan's People

Contributors

bluegorae avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.