Skip to content
Spectral Norm + Conditional GAN
Branch: master
Clone or download
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.
assets
libs
README.md
generate_images.py
net.py
train.py

README.md

SNcGAN - Generate Conditional Images

Live demo: http://adeel.io/sncgan/

Spectral Norm + Conditional GAN

This is a hard fork of @minhnhat93's TensorFlow Spectral Normalization GAN implementation available at: https://github.com/minhnhat93/tf-SNDCGAN. A number of improvements have been made, including the addition of conditioning.

The GAN architecture is depicted here: SNcGAN Architecture

In order to train, you will need:

  • Python 3.5+
  • TensorFlow
  • NumPy
  • SciPy 0.19.1
  • Pillow
  • Pandas

To train, first download CelebA dataset and metadata from http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html:

  • Unzip img_align_celeba.zip to /data/img_align_celeba
  • Copy list_attr_celeba.txt to /data/img_align_celeba

To train, simply run:

  • python train.py

As training progresses, check the output folder for generated samples over time. The first half of the samples grid should be males, and second half females.

To test after training is complete, run:

  • python generate_images.py

You can edit generate_images.py, and modify the conditioning labels. For example, to get new samples of males, smiling, with black hair and mustaches, set the following flags in generate_images.py:

    sample_y['Male'] = 1
    sample_y['Smiling'] = 1
    sample_y['Black_Hair'] = 1
    sample_y['Blond_Hair'] = 0
    sample_y['Mustache'] = 1

Samples will be generated in the output folder, in collage.png.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.