All Projects → gaborvecsei → SLE-GAN

gaborvecsei / SLE-GAN

Licence: MIT License
Towards Faster and Stabilized GAN Training for High-fidelity Few-shot Image Synthesis

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to SLE-GAN

pytorch clip guided loss
A simple library that implements CLIP guided loss in PyTorch.
Stars: ✭ 67 (+26.42%)
Mutual labels:  gan, image-synthesis
GAN-RNN Timeseries-imputation
Recurrent GAN for imputation of time series data. Implemented in TensorFlow 2 on Wikipedia Web Traffic Forecast dataset from Kaggle.
Stars: ✭ 107 (+101.89%)
Mutual labels:  gan, tensorflow2
scrabble-gan
Adversarial Generation of Handwritten Text Images
Stars: ✭ 49 (-7.55%)
Mutual labels:  gan, tensorflow2
steam-stylegan2
Train a StyleGAN2 model on Colaboratory to generate Steam banners.
Stars: ✭ 30 (-43.4%)
Mutual labels:  gan
Deep-Exemplar-based-Video-Colorization
The source code of CVPR 2019 paper "Deep Exemplar-based Video Colorization".
Stars: ✭ 180 (+239.62%)
Mutual labels:  gan
wc-gan
Whitening and Coloring transform for GANs
Stars: ✭ 33 (-37.74%)
Mutual labels:  gan
gan-image-similarity
InfoGAN inspired neural network trained on zap50k images (using Tensorflow + tf-slim). Intermediate layers of the discriminator network are used to do image similarity.
Stars: ✭ 111 (+109.43%)
Mutual labels:  gan
FaceRecognition With FaceNet Android
Face Recognition using the FaceNet model and MLKit on Android.
Stars: ✭ 113 (+113.21%)
Mutual labels:  tensorflow2
SlimGAN
Slimmable Generative Adversarial Networks (AAAI 2021)
Stars: ✭ 20 (-62.26%)
Mutual labels:  gan
Pytorch-Image-Translation-GANs
Pytorch implementations of most popular image-translation GANs, including Pixel2Pixel, CycleGAN and StarGAN.
Stars: ✭ 106 (+100%)
Mutual labels:  gan
maml-rl-tf2
Implementation of Model-Agnostic Meta-Learning (MAML) applied on Reinforcement Learning problems in TensorFlow 2.
Stars: ✭ 16 (-69.81%)
Mutual labels:  tensorflow2
AvatarGAN
Generate Cartoon Images using Generative Adversarial Network
Stars: ✭ 24 (-54.72%)
Mutual labels:  gan
MoveSim
Codes for paper in KDD 2020 (AI for COVID-19): Learning to Simulate Human Mobility
Stars: ✭ 16 (-69.81%)
Mutual labels:  gan
FinRL
FinRL: The first open-source project for financial reinforcement learning. Please star. 🔥
Stars: ✭ 3,497 (+6498.11%)
Mutual labels:  tensorflow2
keras efficientnet v2
self defined efficientnetV2 according to official version. Including converted ImageNet/21K/21k-ft1k weights.
Stars: ✭ 56 (+5.66%)
Mutual labels:  tensorflow2
MUST-GAN
Pytorch implementation of CVPR2021 paper "MUST-GAN: Multi-level Statistics Transfer for Self-driven Person Image Generation"
Stars: ✭ 39 (-26.42%)
Mutual labels:  gan
faceboxes-tensorflow
a tensorflow implement faceboxes
Stars: ✭ 45 (-15.09%)
Mutual labels:  tensorflow2
Course-Project---Speech-Driven-Facial-Animation
ECE 535 - Course Project, Deep Learning Framework
Stars: ✭ 63 (+18.87%)
Mutual labels:  gan
chainer-wasserstein-gan
Chainer implementation of the Wesserstein GAN
Stars: ✭ 20 (-62.26%)
Mutual labels:  gan
ADL2019
Applied Deep Learning (2019 Spring) @ NTU
Stars: ✭ 20 (-62.26%)
Mutual labels:  gan

Towards Faster and Stabilized GAN Training for High-fidelity Few-shot Image Synthesis

Unofficial implementation, with understandability in mind (verbose implementation)

Why the name SLE-GAN? Because the paper introduces a new block in the Generator network called Skip-Layer Excitation (SLE)

512x512 generated images (randomly selected) trained for 9 hours with batch size of 8 on Oxford 17 flowers dataset which contains only 1360 images

The implementation tries to replicate the results from the paper based only on the publication.

What is not discussed in the paper (e.g. filter sizes, training scheduling, hyper parameters), is chosen based on some experiments and previous knowledge.

Usage

You can easily use the separate parts of the code. The Generator and Discriminator are Tensorflow Keras models (tf.keras.models.Model)

For example if you'd like to generate new images:

import sle_gan

G = sle_gan.Generator(output_resolution=512)
G.load_weights("generator_weights.h5")

input_noise = sle_gan.create_input_noise(batch_size=1)
generated_images = G(input_noise)
generated_images = sle_gan.postprocess_images(generated_images, tf.uint8).numpy()

Train

$ python train.py --help

usage: train.py [-h] [--name NAME] [--override] --data-folder DATA_FOLDER
                [--resolution RESOLUTION]
                [--generator-weights GENERATOR_WEIGHTS]
                [--discriminator-weights DISCRIMINATOR_WEIGHTS]
                [--batch-size BATCH_SIZE] [--epochs EPOCHS]
                [--G-learning-rate G_LEARNING_RATE]
                [--D-learning-rate D_LEARNING_RATE] [--diff-augment] [--fid]
                [--fid-frequency FID_FREQUENCY]
                [--fid-number-of-images FID_NUMBER_OF_IMAGES]

optional arguments:
  -h, --help            show this help message and exit
  --name NAME           Name of the experiment
  --override            Removes previous experiment with same name
  --data-folder DATA_FOLDER
                        Folder with the images
  --resolution RESOLUTION
                        Either 256, 512 or 1024. Default is 512.
  --generator-weights GENERATOR_WEIGHTS
  --discriminator-weights DISCRIMINATOR_WEIGHTS
  --batch-size BATCH_SIZE
  --epochs EPOCHS
  --G-learning-rate G_LEARNING_RATE
                        Learning rate for the Generator
  --D-learning-rate D_LEARNING_RATE
                        Learning rate for the Discriminator
  --diff-augment        Apply diff augmentation
  --fid                 If this is used, FID will be evaluated
  --fid-frequency FID_FREQUENCY
                        FID will be evaluated at this frequency (epochs)
  --fid-number-of-images FID_NUMBER_OF_IMAGES
                        This many images will be used for the FID calculation

FID score calculation can be enabled with the --fid flag. Just pay attention that as the caluclation uses the Inception model, you need some extra GPU memory.

Example train command:

$ python train.py --name experiment_1 --resolution 512 --batch-size 8 --diff-augment --fid --fid-number-of-images 256

Differences from the paper

  • Instead of random cropping to get I_{part} now only center cropping is implemented
  • Optionally you can use Differentiable Augmentations (--diff-augment)

Not mentioned in the paper

In these cases I took the freedom and defined these myself based on previous experience

  • Number of filters in the Generator and Discriminator
  • How they change the architecture for resolutions 256, 1024 (or any other resolution)
  • Training schedule, or any hyperparameter connected to the training

Citations

@inproceedings{
    anonymous2021towards,
    title={Towards Faster and Stabilized {\{}GAN{\}} Training for High-fidelity Few-shot Image Synthesis},
    author={Anonymous},
    booktitle={Submitted to International Conference on Learning Representations},
    year={2021},
    url={https://openreview.net/forum?id=1Fqg133qRaI},
    note={under review}
}
@misc{
      zhao2020differentiable,
      title={Differentiable Augmentation for Data-Efficient GAN Training}, 
      author={Shengyu Zhao and Zhijian Liu and Ji Lin and Jun-Yan Zhu and Song Han},
      year={2020},
      eprint={2006.10738},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].