Code Monkey home page Code Monkey logo

am-gan's Introduction

Activation Maximization Generative Adversarial Nets

This is a repository of the reproducible experiment code supporting the paper Activation Maximization Generative Adversarial Nets. We also provide a light weight implimentation here.

In the paper, we thoroughly study how class labels influence GANs' training and proposed an advance method for better usage of class labels with theoretical insight. According to our experiments, the proposed method AM-GAN significantly outperforms the baseline methods including AC-GAN, Improved GAN and CatGAN.


Note that the code is written in python 2.7 with tensorflow 1.2.0, please check your environment before running the code. (DO NOT use higher version tensorflow, such as 1.3, 1.4, 1.5; it currently has trouble with data dependent initialization that we used in the code for Weight Normalization). You may also need to install Pillow, scipy, matplotlib.

"CD" to the "code" folder, and run the code with command line:

For AM-GAN:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB True --AC True --sResultTag AM_GAN

For LabelGAN:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB True --AC False --sResultTag LabelGAN

For AC-GAN*+:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB False --AC True --DIST_AC_GEN_EVEN True --sResultTag AC_GAN*+

For AC-GAN*:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB False --AC True --sResultTag AC_GAN*

For AC-GAN* with decreasing AC weight in G:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB False --AC True --G_AC_WEIGHT 0.1 --sResultTag AC_GAN*_DEC

For AC-GAN (-logD):
CUDA_VISIBLE_DEVICES="0" python main.py --LAB False --AC True --DIST_AC_GEN_ACGAN True --sResultTag AC_GAN

For GAN*:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB False --AC False --D_AC_WEIGHT 0.1 --sResultTag GAN*

For GAN:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB False --AC False --sResultTag GAN

---
For Class Condition Version, add  "--bPredefined True --iResD 1" to the end of each command. For example:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB True --AC True --bPredefined True --iResD 1 --sResultTag AM_GAN_pred 

---
For higher Inception Score, you can increase the capacity of D (or both G and D). For example:
CUDA_VISIBLE_DEVICES="0" python main.py --LAB True --AC True --iFilterDimD 192 (--iFilterDimG 256) --sResultTag AM_GAN_enhanced

"sResultTag" will be part of the result folder name. CUDA_VISIBLE_DEVICES="x" controls the idx of GPU that to be use for current running case.

It will evalutate and log the Inception score and AM score every 10,000 iterations. It usually requires 24-48 hours on a single GeForce GTX 1080TI.

For carrying on previous runing case, run the same command but with additional "--bLoadCheckpoint True". Checkpoint is saved every 1,000 iterations.

Generated samples, log file and so on can be found in "../result/" folder.

Dataset and pre-trained Inception Model will be automatically downloaded.

The pre-trained CIFAR10 classifier, which is nesserrary for evaluating AM score, is provided in folder "pretrained_model".

am-gan's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.