Contribute Media
A thank you to everyone who makes this possible: Read More

The Mustache Movement


Heidi Thorpe

Heidi graduated with Honors in Chemistry from the University of Leeds before taking up a position as an Industrial Chemist with ICI (ORICA). This led to a career in software development working in UK, Aus and USA. In 2000 she became an author by the publication by Addison Wesley of Oracle8i tuning and administration: the essential reference ASIN: B007EIZGOG this was a sales success and translated into German. In her spare time she uses python to write software that allows her to train object classifiers to steal mens' mustaches and put them on the face of Taylor Swift. For this talk she will give a simple introduction to Generative Adversarial Networks using learned "mustache-ness" as an example, implemented with existing python modules

PyconAu 2016 and PyconHK 2016 is her speaking experience


Generative Adversarial Networks (GANs) are a class of neural networks which are powerful and flexible tools. A common application is image generation. I would like to give a simple introduction to GANs using existing python modules and an example of how "mustache-ness" can be learned and applied.


The objective is to showcase the power and flexibility of combining preexisting python modules and applying them to the field of image processing and machine learning. Learning what constitutes "Mustache-ness" in a straight forward and fun example of applying the technology in a 30 min presentation

Attendees will learn tips on image processing, as well as training their own neural network.

An analogy can be considered as a relation between forger and detective. The task of the forger is to create fake examples of original paintings by famous artists. If the fake can pass as an original the the forger can exchange the fake for money. The task of the detective is to catch the forgers. He does this by knowing what are the properties that set the original artist apart and what sort of picture he would create. The detective uses this knowledge to determine whether or not the image is real or fake. From an introduction of what a Generative Adversarial Network is, how they work and how they can be used to generate fake images of mustaches by determining what constitutes "mustache-ness"

You will learn that there are two main components of a GAN – Generator Neural Network and Discriminator Neural Network.

The Generator Network takes an random input and tries to generate a sample of data.

It then generates data which is subsequently fed into a discriminator network D(x). The task of Discriminator Network is to take input either from the real data or from the generator and try to predict whether the input is real or generated.

D(x) solves a binary classification problem using sigmoid function giving output in the range 0 to 1.

You will learn how to define the problem. Do you want to generate fake images or fake text. Having defined the problem you can then collect data for it. You will define how your GAN should look. In our example of "mustache-ness" you will choose a convolutional neural network.

You will see the effect of training the Discriminator on real data for n epochs. Using examples of real mustaches we will generate fake ones. We will see generated fake inputs for the generator and the effect of training the discriminator on fake data. The discriminator will correctly predict them as fake. Subsequently we will see how to train the generator with the output of discriminator. Now we can see a trained generator that can fool the discriminator. Generating fake mustaches that are indistinguishable from real.

Attendees will learn tips on image processing, as well as training your own convolutional neural network.

Showcasing the power of python in a fun, lighthearted way. Hopefully, being informative and entertaining

Recorded at PyCon.DE 2017 Karlsruhe:

Video editing: Sebastian Neubauer & Andrei Dan

Tools: Blender, Avidemux & Sonic Pi

Improve this page