Counting 3,834 Big Data & Machine Learning Frameworks, Toolsets, and Examples...
Suggestion? Feedback? Tweet @stkim1

Last Commit
Jan. 17, 2019
Apr. 5, 2018

SNcGAN - Generate Conditional Images

Live demo:

Spectral Norm + Conditional GAN

This is a hard fork of @minhnhat93's TensorFlow Spectral Normalization GAN implementation available at: 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

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

To train, simply run:

  • python

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

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

    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.