Skip to content

Latest commit

 

History

History
76 lines (63 loc) · 3.5 KB

README.md

File metadata and controls

76 lines (63 loc) · 3.5 KB

AC-GAN

Tensorflow implementation of different Generative Adversarial Networks models

This repo consists of 3 implementations: original GAN, Conditional GAN and AC-GAN.

Usage

conda env create -f environment.yaml
conda activate gan_project
cd src/
python run.py --config ../config.yaml

config.yaml allows you to change model, as well as other hyperparameters.

Models and Details

Results

  • AC-GAN
g_lr=0.0003, d_lr=0.0002 g_lr=0.0003, d_lr=0.0001 g_lr=0.0002, d_lr=0.0001
  • Conditional GAN
g_lr=0.0001, d_lr=0.0001 g_lr=0.0003, d_lr=0.0001 g_lr=0.0001, d_lr=0.0001, lbl_smooth=0.2
  • Simple GAN
g_lr=0.0001, d_lr=0.0001 g_lr=0.0002, d_lr=0.0001 g_lr=0.0002, d_lr=0.0001, lbl_smooth=0.2 g_lr=0.0004, d_lr=0.0003

Comments

GAN objective defines a two-player minimax game. If either side becomes obviously stronger than other, training fails. Thus, I carefully conducted experimentation on hyperparameters (especially on disc and gen learning rates).

Dataset is relatively simple MNIST, thus different architectures is not employed, but easily possible by changing model.py. Current generator has 1.3M, and discriminator has 390K parameters. Generating is harder than discriminating, hence this choice makes sense.

GAN training is further stabilized by using side information such as image labels. Conditional-GAN augments labels in both generator and discriminator, allowing the model to utilize extra information. This creates better image quality, and conditioned generation.

AC-GAN asks the discriminator predict class label, along with 'real or fake' prediction, which results in high dimensional quality image generation. For MNIST, I do not expect to sense any differences between Conditional-GAN and AC-GAN.

I implemented label augmentation as activation map concatenation. Following this gan trick, resulting 7x7 map concatenated to first layer's 128 maps for generator, and 28x28 map concatenated to image as second dimension for discriminator. In addition, AC-GAN, and Conditional-GAN generators are identical.

TODO

merge {simple|cond|ac}_train.py files into single train.py