Skip to content
Spectral Norm + Conditional GAN
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

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.

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.