Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
data_loader.py
main.py
models.py
params.py
utils.py

README.md

GAN (Generative Adversarial Networks)

This script implements the paper Generative Adversarial Networks.

Intro

Criterion is Binary Cross Entropy which defined as following: $$ loss(o, t) = - 1/n \sum_i (t[i] * log(o[i]) + (1 - t[i]) * log(1 - o[i])) $$

For discriminator model, cost functions is: $$ \mathcal{L}{D,total}=\mathcal{L}{D, real} + \mathcal{L}{D, fake} \ \mathcal{L}D=-\frac{1}{2} \mathbb{E}{x\sim p{data}} \log D(x) - \frac{1}{2} \mathbb{E}_{z} \log (1-D(G(z))) $$

For generator model, we use heuristically designed non-saturating cost function instead of the minimax one: $$ \mathcal{L}G=\mathcal{L}{G, fake} = - \frac{1}{2} \mathbb{E}_{z} \log (D(G(z))) $$

Usage

Run python3 main.py to start training GAN.

Structure

  • data_loader.py: dataset setting and data loader.
  • models.py: discriminator and generator network model.
  • params.py: parameters for the training process.
  • utils.py: some useful fuctions for training.

Result

  • Images from MNIST dataset:

    GAN_real_images

  • Images generated by model (300 iters):

    GAN_fake_images-300