One of the attractive characteristics of deep neural networks is their ability to transfer knowledge obtained in one domain to other related domains. As a result, high-quality networks can be trained in domains with relatively little training data. This property has been extensively studied for discriminative networks but has received significantly less attention for generative models. Given the often enormous effort required to train GANs, both computationally as well as in the dataset collection, the re-use of pretrained GANs is a desirable objective. We propose a novel knowledge transfer method for generative models based on mining the knowledge that is most beneficial to a specific target domain, either from a single or multiple pretrained GANs. This is done using a miner network that identifies which part of the generative distribution of each pretrained GAN outputs samples closest to the target domain. Mining effectively steers GAN sampling towards suitable regions of the latent space, which facilitates the posterior finetuning and avoids pathologies of other methods such as mode collapse and lack of flexibility. We perform experiments on several complex datasets using various GAN architectures (BigGAN, Progressive GAN) and show that the proposed method, called MineGAN, effectively transfers knowledge to domains with few target images, outperforming existing methods. In addition, MineGAN can successfully transfer knowledge from multiple pretrained GANs.
Training for MineGAN on StyleGANv2
Training for MineGAN on StyleGAN
Training for MineGAN on mnist
- Python2.7, NumPy, SciPy, NVIDIA GPU
- Tensorflow/Pytorch: the version of tensorflow should be more 1.0(https://www.tensorflow.org/), pytorch is more 0.4
- Dataset: MNIST, CelebA, HHFQ, Imagenet, Places365 or your dataset
- Install tensorflow/pytorch
-
git clone git@github.com:yaxingwang/MineGAN.git
to getMineGA
-
Pretrained model: downloading the pretrained model from Biggan, and put it into
data/your_data/weights
. Note usingG_ema.pth
to replaceG.pth
, since we dones't useema
. The pretrained model is moved intoMineGA/weights/biggan
-
Downloading inception model and moving it into
MineGA
-
Preparing data: leveraging
sh scripts/utils/prepare_data.py
, and put it intodata/your_data/data
. Please check Biggan to learn how to generate the data -
Traing:
sh scripts/launch_BigGAN_bs256x8.sh
If you run into any problems with this code, please submit a bug report on the Github site of the project. For another inquries pleace contact with me: yaxing@cvc.uab.es