The InfoGAN ANN is used to change parameters like thickness and angle for pictures of the MNIST dataset. ( We used it to try to change parameters in simple geometric shapes (ellipses, triangles, rectangles). While some structural changes of the shapes can be observed we cannot explain what parameters of the netw…
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.
InfoGAN overview.png

Instructions to use InfoGAN for Shapes


You need:

  • to clone our github repository

$ git clone

  • python2.7 (not in a virtual environment!)
  • pip
  • an old version of prettytensor, this will install a new version of tensorflow, so be sure to do this before you install the the old version of tensorflow). You can run:

$ export PT_BINARY_URL=
$ sudo pip install --upgrade $PT_BINARY_URL

  • progressbar:

$ pip install progressbar

  • dateutil:

$ pip install python-dateutil

  • pygame (To create shapes yourself):

$ pip install pygame

  • scipy (To create shapes yourself):

$ pip install scipy

  • Pillow (To create shapes yourself):

$ pip install Pillow

  • Tensorflow 0.9.0, (first install prettytensor!) to get this specific version if you are on Linux you can run:

$ export TF_BINARY_URL=
$ sudo pip install --upgrade $TF_BINARY_URL

Run our version

The file image.pkl that is used for InfoGAN and currently in the github repository contains not rotated shapes, only right triangles and only shapes that are somewhere in the middle of the images. To simply run this version with 100 Epochs and two uniform variables, go into your InfoGAN directory and run:

$ PYTHONPATH='.' python launchers/

To call tensorboard type:

$ tensorboard --logdir logs/shape/

Change Shapes

If you want to change the shapes that are used for InfoGAN you have to run (in the labrotation-ai directory) with your changes. This will create a new images.pkl file. After running

$ python

you can switch to the InfoGAN directory and run the aforementioned commands.

Currently supported shape options are:

  • Rotation of rectangles and ellipses in specified angles
  • Only using shapes that originate somewhere in the middle of the image or all shapes
  • Using right triangles or use all triangles
  1. To change rotation of rectangles and ellipses open labrotation-ai/ and go to the main method (at the end of the script). The variable “rotationAngles” needs a list of all angles in which the shapes should be rotated. Be sure to only use angles up to 90°, as the shapes already exist in 90°, 180° and 270° rotation and those will also be rotated. Example: To rotate the shapes in 15°-Steps the “rotationAngles” should be [15,30,45,60,75].

  2. To change that the shapes shouldn’t originate in the middle of the image, open labrotation-ai/ and change every call of “checkMatrixAndMiddle” to “checkMatrix”.

  3. To use all triangles instead of only right triangles open labrotation-ai/ and go to the main method (at the end of the script). Decomment “createTriangles(...)” and comment “createRightTriangles(...)”.

Change InfoGAN

Generation variables

The current version of InfoGAN can cope with Uniform variables, Gaussian and MeanBernoulli with value 1, and categorical variables with 10 categories. To change what variables will be used for the generation open labrotation-ai/InfoGAN/launchers/ and type change them in latent_spec.

Categorical variables

If you want more or less categories for the categorical variable additionally to you also have to change in labrotation-ai/InfoGAN/infogan/algos/ the function visualize_all_factors(...). Change all 10s to your new number of categories and all 100s to your (number of categories)². Right now it is not possible to have different visualization for categorical and uniform variables.


If you want to change the Network itself it should be possible to change it in labrotation-ai/InfoGAN/infogan/models/ in the init function. But no guaranty that this works, we haven’t tested it.