All Projects → akanimax → Fagan

akanimax / Fagan

Licence: mit
A variant of the Self Attention GAN named: FAGAN (Full Attention GAN)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Fagan

Bmsg Gan
[MSG-GAN] Any body can GAN! Highly stable and robust architecture. Requires little to no hyperparameter tuning. Pytorch Implementation
Stars: ✭ 518 (+393.33%)
Mutual labels:  artificial-intelligence, gan
Cool Fashion Papers
👔👗🕶️🎩 Cool resources about Fashion + AI! (papers, datasets, workshops, companies, ...) (constantly updating)
Stars: ✭ 464 (+341.9%)
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 (+100%)
Mutual labels:  artificial-intelligence, gan
Hypergan
Composable GAN framework with api and user interface
Stars: ✭ 1,104 (+951.43%)
Mutual labels:  artificial-intelligence, gan
Tensorlayer
Deep Learning and Reinforcement Learning Library for Scientists and Engineers 🔥
Stars: ✭ 6,796 (+6372.38%)
Mutual labels:  artificial-intelligence, gan
Gans In Action
Companion repository to GANs in Action: Deep learning with Generative Adversarial Networks
Stars: ✭ 748 (+612.38%)
Mutual labels:  artificial-intelligence, gan
Gp Gan
Official Chainer implementation of GP-GAN: Towards Realistic High-Resolution Image Blending (ACMMM 2019, oral)
Stars: ✭ 317 (+201.9%)
Mutual labels:  artificial-intelligence, gan
Pytorch Pretrained Biggan
🦋A PyTorch implementation of BigGAN with pretrained weights and conversion scripts.
Stars: ✭ 779 (+641.9%)
Mutual labels:  artificial-intelligence, gan
Artificialintelligenceengines
Computer code collated for use with Artificial Intelligence Engines book by JV Stone
Stars: ✭ 35 (-66.67%)
Mutual labels:  artificial-intelligence, gan
Text Gan Tensorflow
TensorFlow GAN implementation using Gumbel Softmax
Stars: ✭ 87 (-17.14%)
Mutual labels:  artificial-intelligence, gan
Text predictor
Char-level RNN LSTM text generator📄.
Stars: ✭ 99 (-5.71%)
Mutual labels:  artificial-intelligence
Lsd Seg
Learning from Synthetic Data: Addressing Domain Shift for Semantic Segmentation
Stars: ✭ 99 (-5.71%)
Mutual labels:  gan
Milestones
The Automagic Project Planner
Stars: ✭ 102 (-2.86%)
Mutual labels:  artificial-intelligence
Pose Interpreter Networks
Real-Time Object Pose Estimation with Pose Interpreter Networks (IROS 2018)
Stars: ✭ 104 (-0.95%)
Mutual labels:  artificial-intelligence
Exploration By Disagreement
[ICML 2019] TensorFlow Code for Self-Supervised Exploration via Disagreement
Stars: ✭ 99 (-5.71%)
Mutual labels:  artificial-intelligence
Spectralnormalizationkeras
Spectral Normalization for Keras Dense and Convolution Layers
Stars: ✭ 100 (-4.76%)
Mutual labels:  gan
Neuronblocks
NLP DNN Toolkit - Building Your NLP DNN Models Like Playing Lego
Stars: ✭ 1,356 (+1191.43%)
Mutual labels:  artificial-intelligence
Sigma
Rocket powered machine learning. Create, compare, adapt, improve - artificial intelligence at the speed of thought.
Stars: ✭ 98 (-6.67%)
Mutual labels:  artificial-intelligence
Helix theory
螺旋论(theory of helix)—— “熵减机理论(可用来构建AGI、复杂性系统等)”
Stars: ✭ 98 (-6.67%)
Mutual labels:  artificial-intelligence
Tensorflow2.0 Examples
🙄 Difficult algorithm, Simple code.
Stars: ✭ 1,397 (+1230.48%)
Mutual labels:  gan

fagan

A variant of the Self Attention GAN named: FAGAN (Full Attention GAN). The architecture of this gan contains the full attention layer as proposed in this project.

The project uses package named attn-gan-pytorch created by me, which is available at https://pypi.org/project/attn-gan-pytorch/ .

Celeba samples

celeba training samples
samples generated during training of the proposed architecture on the celeba dataset.

Full attention layer

proposed full attention layer

The above figure describes the architecture of the proposed full attention layer. As you can see, on the upper path we compute traditional convolution output and the lower path, we have an attention layer which generalises to (k x k) convolution filters instead of just (1 x 1) filters. The alpha shown in the residual calculation is a trainable parameter.


Now why is the lower path not self attention? The reason for it is that while computing the attention maps, the input is first locally aggregated by the (k x k) convolutions, and therefore is no longer just self attention since it uses a small spatially neighbouring area into computations. Given enough depth and filter size, we could cover the entire input image as a receptive field for a subsequent attention calculation, hence the name: Full Attention.

Celeba Experiment

Hinge-Gan loss experiment

The following diagram is the plot of the loss (Hinge-GAN) generated from the loss-logs obtained during training.

celeba loss plot

Relativistic Hinge-Gan loss experiment

The training of the relativistic version is percetually better (stabler). Please refer to the following loss_plot for this experiment for more info.

relativistic celeba loss plot

Running the Code

Running the training is actually very simple. Just install the attn_gan_pytorch package using the following command

$ workon [your virtual environment]
$ pip install attn-gan-pytorch

And then run the training by running the train.py script. Refer to the following parameters for tweaking for your own use:

optional arguments:
  -h, --help            show this help message and exit
  --generator_config GENERATOR_CONFIG
                        default configuration for generator network
  --discriminator_config DISCRIMINATOR_CONFIG
                        default configuration for discriminator network
  --generator_file GENERATOR_FILE
                        pretrained weights file for generator
  --discriminator_file DISCRIMINATOR_FILE
                        pretrained_weights file for discriminator
  --images_dir IMAGES_DIR
                        path for the images directory
  --sample_dir SAMPLE_DIR
                        path for the generated samples directory
  --model_dir MODEL_DIR
                        path for saved models directory
  --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
  --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
  --data_percentage DATA_PERCENTAGE
                        percentage of data to use
  --num_workers NUM_WORKERS
                        number of parallel workers for reading files

Trained weights for generating cool faces :)

refer to the models/fagan_1/ directory to find the saved weights for this model in pytorch format. For spawning the architectures, refer to the configs/ folder for loading the generator and discriminator configurations.

Other links

medium blog -> https://medium.com/@animeshsk3/fagan-full-attention-gan-2a29227dc014
attn_gan_pytorch package -> https://pypi.org/project/attn-gan-pytorch/

Thanks

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

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