The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR) 2022
[Paper] [Project Page] [Slides] [Poster] [Data Repository]
Code/Project page will be actively updated.
In this work, we take a closer look at few-shot image generation (FSIG) problem. Our analysis discovers that: current methods for FSIG achieve similar quality of generated images after few-shot adaptation on target training images, while the main difference is on the diversity of those generated samples. State-of-the-art FSIG algorithms generates visual-pleasant images with both high-quality and high-diversity.
Based on our analysis, we propose a mutual-information based contrastive learning algorithm (DCL) that preserves the diversity of generated images during adaptation.
- Platform: Linux
- Tesla V100 GPUs / (or A100 GPUs)
- PyTorch 1.7.0
- Python 3.6.9
- lmdb, tqdm
Alternatively, A suitable conda environment named fsig
can be created and activated with:
git clone https://github.com/yunqing-me/A-Closer-Look-at-FSIG.git
conda env create -f environment.yml
conda activate fsig
cd A-Closer-Look-at-FSIG
Prepare the few-shot training dataset using lmdb
format
For example, download the 10-shot target set, Babies
(Link) and AFHQ-Cat
(Link), and organize your directory as follows:
10-shot-{babies/afhq_cat}
└── images
└── image-1.png
└── image-2.png
└── ...
└── image-10.png
Then, transform to lmdb
format:
python prepare_data.py --input_path [your_data_path_of_{babies/afhq_cat}] --output_path ./_processed_train/[your_lmdb_data_path_of_{babies/afhq_cat}]
Prepare the entire target dataset for evaluation
For example, download the entire dataset, Babies
(Link) and AFHQ-Cat
(Link), and organize your directory as follows:
entire-{babies/afhq_cat}
└── images
└── image-1.png
└── image-2.png
└── ...
└── image-n.png
Then, transform to lmdb format for evaluation
python prepare_data.py --input_path [your_data_path_of_entire_{babies/afhq_cat}] --output_path ./_processed_test/[your_lmdb_data_path_of_entire_{babies/afhq_cat}]
Download the GAN model pretrained on FFHQ from here. Then, save it to ./_pretrained/style_gan_source_ffhq.pt
.
If you find our work useful in your research, please consider citing our paper:
@InProceedings{Zhao_2022_CVPR,
author = {Zhao, Yunqing and Ding, Henghui and Huang, Houjing and Cheung, Ngai-Man},
title = {A Closer Look at Few-Shot Image Generation},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2022},
pages = {9140-9150}
}