SinGAN: Learning a Generative Model from a Single Natural Image
SinGAN
Paper
Website
Github Official PyTorch Implementation
SinGAN: Learning a Generative Model from a Single Natural Image
Authors: Tamar Rott Shaham (Technion), Tali Dekel (Google Research), Tomer Michaeli (Technion)
Basic Idea
Bootstrap patches of the original image and build GANs which can add fine details to blurry patches at different path sizes.
- Start by building a GAN to generate low-resolution versions of the original image
- Then upscale the image and build a GAN to add details to patches of your upscaled image
- Fix the parameters of the previous GAN. Upscale the outputs and repeat.
Architecture
They build \(\displaystyle N\) GANs.
Each GAN \(\displaystyle G_n\) adds details to patches of the image produced by GAN \(\displaystyle G_{n+1}\) below it.
The final GAN \(\displaystyle G_0\) adds only fine details.
Generator
The use N generators.
Each generator consists of 5 convolutional blocks:
Conv(</math>3 \times 3</math>)-BatchNorm-LeakyReLU.
They use 32 kernels per block at the coarsest scale and increase \(\displaystyle 2 \times\) every 4 scales.
Discriminator
The architecture is the same as the generator.
The patch size is \(\displaystyle 11 \times 11\)
Training and Loss Function
\(\displaystyle \min_{G_n} \max_{D_n} \mathcal{L}_{adv}(G_n, D_n) + \alpha \mathcal{L}_{rec}(G_n)\)
They use a combination of the standard GAN adversarial loss and a reconstruction loss.
Adversarial Loss
They use the WGAN-GP loss.
The final loss is the average over all the patches.
Reconstruction Loss
\(\displaystyle \mathcal{L}_{rec} = \Vert G_n(0,(\bar{x}^{rec}_{n+1}\uparrow^r) - x_n \Vert ^2\)
The reconstruction loss ensures that the original image can be built by the GAN.
Rather than inputting noise to the generators, they input
\(\displaystyle \{z_N^{rec}, z_{N-1}^{rec}, ..., z_0^{rec}\} = \{z^*, 0, ..., 0\}\)
where the initial noise \(\displaystyle z^*\) is drawn once and then fixed during the rest of the training.
The standard deviation \(\displaystyle \sigma_n\) of the noise \(\displaystyle z_n\) is proportional to the root mean squared error (RMSE) between the reconstructed patch and the original patch.
Evaluation
They evaluate their method using an Amazon Mechanical Turk (AMT) user study and using Single Image Frechet Inception Distance
Amazon Mechanical Turk Study
Frechet Inception Distance
Results
Below are images of their results from their paper and website.
Applications
The following are applications they identify.
The basic idea for each of these applications is to start at an intermediate layer rather than the bottom layer.
While the bottom layer is a purely unconditional GAN, the intermediate generators are more akin to conditional GANs.
Super-Resolution
Paint-to-Image
Harmonization
Editing
Single Image Animation
Repo
The official repo for SinGAN can be found on their Github Repo