gans-implementations

A bunch of GAN implementations


License
MIT
Install
pip install gans-implementations==0.1.0

Documentation

GANs-Implementations

License PyPi Version PyPi Downloads Package Status

GANs Implementations and other generative models + Training (in ./notebooks)

Implemented:

  • Vanilla GAN
  • DCGAN - Deep Convolutional GAN
  • WGAN - Wasserstein GAN
  • SNGAN - Spectrally Normalized GAN
  • SRGAN - Super Resolution GAN
  • StyleGAN
  • Pix2PixHD
  • C-VAE - Convolutional Variational Auto-encoder

Installation

PyPi Installation

$ pip install gans-implementations

Local Install and Run:

$ cd {PROJECT_DIRECTORY}
$ pip install -e .

Example

In notebooks directory there is a notebook on how to use each of these models for their intented use case; such as image generation for StyleGAN and others. Check them out!

from gans_package.models import StyleGAN_Generator, StyleGAN_Discriminator

in_channels = 256
out_channels = 3
hidden_channels = 512
z_dim = 128
mapping_hidden_size = 256
w_dim = 512
synthesis_layers = 5
kernel_size=3

in_size = 3
d_hidden_size = 16

g = StyleGAN_Generator(in_channels, 
                       out_channels, 
                       hidden_channels, 
                       z_dim, 
                       mapping_hidden_size, 
                       w_dim, 
                       synthesis_layers, 
                       kernel_size, 
                       device=DEVICE).to(DEVICE)

d = StyleGAN_Discriminator(in_size, d_hidden_size).to(DEVICE)

import torch

noise = torch.randn(BATCH_SIZE, z_dim).to(DEVICE)

fake = g(noise)
pred = d(fake)

Handwritten Digits - MNIST

Work Cited

https://arxiv.org/pdf/1609.04802v5.pdf

https://arxiv.org/pdf/1812.04948.pdf

https://www.coursera.org/specializations/generative-adversarial-networks-gans?