All Projects → akanimax → Bmsg Gan

akanimax / Bmsg Gan

Licence: mit
[MSG-GAN] Any body can GAN! Highly stable and robust architecture. Requires little to no hyperparameter tuning. Pytorch Implementation

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Bmsg Gan

Artificialintelligenceengines
Computer code collated for use with Artificial Intelligence Engines book by JV Stone
Stars: ✭ 35 (-93.24%)
Mutual labels:  artificial-intelligence, gan
Tensorlayer
Deep Learning and Reinforcement Learning Library for Scientists and Engineers 🔥
Stars: ✭ 6,796 (+1211.97%)
Mutual labels:  artificial-intelligence, gan
Gans In Action
Companion repository to GANs in Action: Deep learning with Generative Adversarial Networks
Stars: ✭ 748 (+44.4%)
Mutual labels:  artificial-intelligence, gan
Gp Gan
Official Chainer implementation of GP-GAN: Towards Realistic High-Resolution Image Blending (ACMMM 2019, oral)
Stars: ✭ 317 (-38.8%)
Mutual labels:  artificial-intelligence, gan
Fagan
A variant of the Self Attention GAN named: FAGAN (Full Attention GAN)
Stars: ✭ 105 (-79.73%)
Mutual labels:  artificial-intelligence, gan
Hypergan
Composable GAN framework with api and user interface
Stars: ✭ 1,104 (+113.13%)
Mutual labels:  artificial-intelligence, gan
Pytorch Pretrained Biggan
🦋A PyTorch implementation of BigGAN with pretrained weights and conversion scripts.
Stars: ✭ 779 (+50.39%)
Mutual labels:  artificial-intelligence, gan
Text Gan Tensorflow
TensorFlow GAN implementation using Gumbel Softmax
Stars: ✭ 87 (-83.2%)
Mutual labels:  artificial-intelligence, gan
Gan Sandbox
Vanilla GAN implemented on top of keras/tensorflow enabling rapid experimentation & research. Branches correspond to implementations of stable GAN variations (i.e. ACGan, InfoGAN) and other promising variations of GANs like conditional and Wasserstein.
Stars: ✭ 210 (-59.46%)
Mutual labels:  artificial-intelligence, gan
Cool Fashion Papers
👔👗🕶️🎩 Cool resources about Fashion + AI! (papers, datasets, workshops, companies, ...) (constantly updating)
Stars: ✭ 464 (-10.42%)
Mutual labels:  artificial-intelligence, gan
Deep Learning Book
《Deep Learning》《深度学习》 by Ian Goodfellow, Yoshua Bengio and Aaron Courville
Stars: ✭ 492 (-5.02%)
Mutual labels:  gan
Awesome Cvpr Paper
CVPR 论文收集,包含但不限于2021、2020、2019、2018、2017文章
Stars: ✭ 493 (-4.83%)
Mutual labels:  artificial-intelligence
Gluon Cv
Gluon CV Toolkit
Stars: ✭ 5,001 (+865.44%)
Mutual labels:  gan
Nlp Notebooks
A collection of notebooks for Natural Language Processing from NLP Town
Stars: ✭ 513 (-0.97%)
Mutual labels:  artificial-intelligence
T2f
T2F: text to face generation using Deep Learning
Stars: ✭ 494 (-4.63%)
Mutual labels:  gan
Seqgan
A simplified PyTorch implementation of "SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient." (Yu, Lantao, et al.)
Stars: ✭ 502 (-3.09%)
Mutual labels:  gan
Learn Data Science For Free
This repositary is a combination of different resources lying scattered all over the internet. The reason for making such an repositary is to combine all the valuable resources in a sequential manner, so that it helps every beginners who are in a search of free and structured learning resource for Data Science. For Constant Updates Follow me in …
Stars: ✭ 4,757 (+818.34%)
Mutual labels:  artificial-intelligence
Godot Steering Ai Framework
A complete framework for Godot to create beautiful and complex AI motion. Works both in 2D and in 3D.
Stars: ✭ 482 (-6.95%)
Mutual labels:  artificial-intelligence
Deblur Gan
Keras implementation of "DeblurGAN: Blind Motion Deblurring Using Conditional Adversarial Networks"
Stars: ✭ 483 (-6.76%)
Mutual labels:  gan
Hidt
Official repository for the paper "High-Resolution Daytime Translation Without Domain Labels" (CVPR2020, Oral)
Stars: ✭ 513 (-0.97%)
Mutual labels:  gan

BMSG-GAN

PyTorch implementation of [MSG-GAN].

**Please note that this is not the repo for the MSG-GAN research paper. Please head over to the msg-stylegan-tf repository for the official code and trained models for the MSG-GAN paper.

SageMaker

Training is now supported on AWS SageMaker. Please read https://docs.aws.amazon.com/sagemaker/latest/dg/pytorch.html

Flagship Diagram

MSG-GAN: Multi-Scale Gradient GAN for Stable Image Synthesis

Abstract:
While Generative Adversarial Networks (GANs) have seen huge successes in image synthesis tasks, they are notoriously difficult to use, in part due to instability during training. One commonly accepted reason for this instability is that gradients passing from the discriminator to the generator can quickly become uninformative, due to a learning imbalance during training. In this work, we propose the Multi-Scale Gradient Generative Adversarial Network (MSG-GAN), a simple but effective technique for addressing this problem which allows the flow of gradients from the discriminator to the generator at multiple scales. This technique provides a stable approach for generating synchronized multi-scale images. We present a very intuitive implementation of the mathematical MSG-GAN framework which uses the concatenation operation in the discriminator computations. We empirically validate the effect of our MSG-GAN approach through experiments on the CIFAR10 and Oxford102 flowers datasets and compare it with other relevant techniques which perform multi-scale image synthesis. In addition, we also provide details of our experiment on CelebA-HQ dataset for synthesizing 1024 x 1024 high resolution images.

Training time-lapse gif

An explanatory training time-lapse video/gif for the MSG-GAN. The higher resolution layers initially display plain colour blocks but eventually (very soon) the training penetrates all layers and then they all work in unison to produce better samples. Please observe the first few secs of the training, where the face like blobs appear in a sequential order from the lowest resolution to the highest resolution.

Multi-Scale Gradients architecture

proposed MSG-GAN architecture

The above figure describes the architecture of MSG-GAN for generating synchronized multi-scale images. Our method is based on the architecture proposed in proGAN, but instead of a progressively growing training scheme, includes connections from the intermediate layers of the generator to the intermediate layers of the discriminator. The multi-scale images input to the discriminator are converted into spatial volumes which are concatenated with the corresponding activation volumes obtained from the main path of convolutional layers.


For the discrimination process, appropriately downsampled versions of the real images are fed to corresponding layers of the discriminator as shown in the diagram (from above).


synchronization explanation


Above figure explains how, during training, all the layers in the MSG-GAN first synchronize colour-wise and subsequently improve the generated images at various scales. The brightness of the images across all layers (scales) synchronizes eventually

Running the Code

Please note to use value of learning_rate=0.003 for both G and D for all experiments for best results. The model is quite robust and converges to a very similar FID or IS very quickly even for different learning rate settings. Please use the relativistic-hinge as the loss function (set as default) for training.

Start the training by running the train.py script in the sourcecode/ directory. Refer to the following parameters for tweaking for your own use:

-h, --help            show this help message and exit
  --generator_file GENERATOR_FILE
                        pretrained weights file for generator
  --generator_optim_file GENERATOR_OPTIM_FILE
                        saved state for generator optimizer
  --shadow_generator_file SHADOW_GENERATOR_FILE
                        pretrained weights file for the shadow generator
  --discriminator_file DISCRIMINATOR_FILE
                        pretrained_weights file for discriminator
  --discriminator_optim_file DISCRIMINATOR_OPTIM_FILE
                        saved state for discriminator optimizer
  --images_dir IMAGES_DIR
                        path for the images directory
  --folder_distributed FOLDER_DISTRIBUTED
                        whether the images directory contains folders or not
  --flip_augment FLIP_AUGMENT
                        whether to randomly mirror the images during training
  --sample_dir SAMPLE_DIR
                        path for the generated samples directory
  --model_dir MODEL_DIR
                        path for saved models directory
  --loss_function LOSS_FUNCTION
                        loss function to be used: standard-gan, wgan-gp,
                        lsgan,lsgan-sigmoid,hinge, relativistic-hinge
  --depth DEPTH         Depth of the GAN
  --latent_size LATENT_SIZE
                        latent size for the generator
  --batch_size BATCH_SIZE
                        batch_size for training
  --start START         starting epoch number
  --num_epochs NUM_EPOCHS
                        number of epochs for training
  --feedback_factor FEEDBACK_FACTOR
                        number of logs to generate per epoch
  --num_samples NUM_SAMPLES
                        number of samples to generate for creating the grid
                        should be a square number preferably
  --checkpoint_factor CHECKPOINT_FACTOR
                        save model per n epochs
  --g_lr G_LR           learning rate for generator
  --d_lr D_LR           learning rate for discriminator
  --adam_beta1 ADAM_BETA1
                        value of beta_1 for adam optimizer
  --adam_beta2 ADAM_BETA2
                        value of beta_2 for adam optimizer
  --use_eql USE_EQL     Whether to use equalized learning rate or not
  --use_ema USE_EMA     Whether to use exponential moving averages or not
  --ema_decay EMA_DECAY
                        decay value for the ema
  --data_percentage DATA_PERCENTAGE
                        percentage of data to use
  --num_workers NUM_WORKERS
                        number of parallel workers for reading files
Sample Training Run

For training a network at resolution 256 x 256, use the following arguments:

$ python train.py --depth=7 \ 
                  --latent_size=512 \
                  --images_dir=<path to images> \
                  --sample_dir=samples/exp_1 \
                  --model_dir=models/exp_1

Set the batch_size, feedback_factor and checkpoint_factor accordingly. We used 2 Tesla V100 GPUs of the DGX-1 machine for our experimentation.

Generated samples on different datasets

⭐️ [NEW] ⭐️ CelebA HQ [1024 x 1024] (30K dataset)
CelebA-HQ


⭐️ [NEW] ⭐️ Oxford Flowers (improved samples) [256 x 256] (8K dataset)
oxford_big oxford_variety


CelebA HQ [256 x 256] (30K dataset)
CelebA-HQ


LSUN Bedrooms [128 x 128] (3M dataset)
lsun_bedrooms


CelebA [128 x 128] (200K dataset)
CelebA


Synchronized all-res generated samples

Cifar-10 [32 x 32] (50K dataset)
cifar_allres


Oxford-102 Flowers [256 x 256] (8K dataset)
flowers_allres


Cite our work

@article{karnewar2019msg,
  title={MSG-GAN: Multi-Scale Gradient GAN for Stable Image Synthesis},
  author={Karnewar, Animesh and Wang, Oliver and Iyengar, Raghu Sesha},
  journal={arXiv preprint arXiv:1903.06048},
  year={2019}
}

Other Contributors 😄

Cartoon Set [128 x 128] (10K dataset) by @huangzh13
Cartoon_Set


Thanks

Please feel free to open PRs here if you train on other datasets using this architecture.

Best regards,
@akanimax :)

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].