Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 4.38 KB

README.md

File metadata and controls

66 lines (48 loc) · 4.38 KB

SinGAN (ICCV'2019)

Singan: Learning a Generative Model from a Single Natural Image

Task: Internal Learning

Abstract

We introduce SinGAN, an unconditional generative model that can be learned from a single natural image. Our model is trained to capture the internal distribution of patches within the image, and is then able to generate high quality, diverse samples that carry the same visual content as the image. SinGAN contains a pyramid of fully convolutional GANs, each responsible for learning the patch distribution at a different scale of the image. This allows generating new samples of arbitrary size and aspect ratio, that have significant variability, yet maintain both the global structure and the fine textures of the training image. In contrast to previous single image GAN schemes, our approach is not limited to texture images, and is not conditional (i.e. it generates samples from noise). User studies confirm that the generated samples are commonly confused to be real images. We illustrate the utility of SinGAN in a wide range of image manipulation tasks.

Results and Models

SinGAN balloons
Model Dataset Num Scales Download
SinGAN balloons.png 8 ckpt | pkl
SinGAN fish.jpg 10 ckpt | pkl
SinGAN bohemian.png 10 ckpt | pkl

Notes for using SinGAN

When training SinGAN models, users may obtain the number of scales (stages) in advance via the following commands. This number is important for constructing config file, which is related to the generator, discriminator, the training iterations and so on.

>>> from mmgen.datasets.singan_dataset import create_real_pyramid
>>> import mmcv
>>> real = mmcv.imread('real_img_path')
>>> _, _, num_scales = create_real_pyramid(real, min_size=25, max_size=300, scale_factor_init=0.75)

When testing SinGAN models, users have to modify the config file to add the test_cfg. As shown in configs/singan/singan_balloons.py, the only thing you need to do is add the path for pkl data. There are some important data containing in the pickle files which you can download from our website.

test_cfg = dict(
    _delete_ = True
    pkl_data = 'path to pkl data'
)

Citation

@inproceedings{shaham2019singan,
  title={Singan: Learning a generative model from a single natural image},
  author={Shaham, Tamar Rott and Dekel, Tali and Michaeli, Tomer},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={4570--4580},
  year={2019},
  url={https://openaccess.thecvf.com/content_ICCV_2019/html/Shaham_SinGAN_Learning_a_Generative_Model_From_a_Single_Natural_Image_ICCV_2019_paper.html},
}