General adverserial networks

General Adverserial Networks


Generative adversarial networks (GANs) are a class of artificial intelligence algorithms used in unsupervised machine learning, implemented by a system of two neural networks contesting with each other in a zero-sum game framework. They were introduced by Ian Goodfellow et al. in 2014,[1] although the idea of adversarial training dates back to Jürgen Schmidhuber in 1992.[2]

This technique can generate photographs that look authentic to human observers. For example, a synthetic photograph of a cat that fools the discriminator into accepting it as an actual photograph.[3]

One network generates candidates and one evaluates them.[1] Typically, the generative network learns to map from a latent space to a particular data distribution of interest, while the discriminative network discriminates between instances from the true data distribution and candidates produced by the generator. The generative network’s training objective is to increase the error rate of the discriminative network (i.e., “fool” the discriminator network by producing novel synthesized instances that appear to have come from the true data distribution).[1][4]

In practice, a known dataset serves as the initial training data for the discriminator. Training the discriminator involves presenting it with samples from the dataset, until it reaches some level of accuracy. Typically the generator is seeded with a randomized input that is sampled from a predefined latent space (e.g. a multivariate normal distribution). Thereafter, samples synthesized by the generator are evaluated by the discriminator. Backpropagation is applied in both networks so that the generator produces better images, while the discriminator becomes more skilled at flagging synthetic images. [5] The generator is typically a deconvolutional neural network, and the discriminator is a convolutional neural network.

The idea to infer models in a competitive setting (model versus discriminator) was proposed by Li, Gauci and Gross in 2013.[6] Their method is used for behavioral inference. It is termed Turing Learning,[7] as the setting is akin to that of a Turing test.

Application title GANs have been used to produce samples of photorealistic images for the purposes of visualizing new interior/industrial design, shoes, bags and clothing items or items for computer games’ scenes. These networks were reported to be used by Facebook.[8] Recently, GANs have modeled patterns of motion in video. They have also been used to reconstruct 3D models of objects from images and to improve astronomical images.


The original, genuine data set I: The random noise that goes into the generator as a source of entropy G: The generator which tries to copy/mimic the original data set D: The discriminator which tries to tell apart G’s output from R The actual ‘training’ loop where we teach G to trick D and D to beware G.

In [2]: File “”, line 1 ^ SyntaxError: invalid syntax How does a GAN learn? title A general adverserial network are two neural networks, one generator and one discriminator. The job of the generator is to create stimuli that can fool the discriminator.


The DCGAN network takes as input 100 random numbers drawn from a uniform distribution (we refer to these as a code, or latent variables, in red) and outputs an image (in this case 64x64x3 images on the right, in green). As the code is changed incrementally, the generated images do too — this shows the model has learned features to describe how the world looks, rather than just memorizing some examples. The network (in yellow) is made up of standard convolutional neural network components, such as deconvolutional layers (reverse of convolutional layers), fully connected layers, etc.: title

title DCGAN is initialized with random weights, so a random code plugged into the network would generate a completely random image. However, as you might imagine, the network has millions of parameters that we can tweak, and the goal is to find a setting of these parameters that makes samples generated from random codes look like the training data. Or to put it another way, we want the model distribution to match the true data distribution in the space of images.

Conditional DCGAN title

Tensorflow DCGAN


Deep completion blog post

Image completion

Online Demo

Blogpost about GANS

Learning even more about GANS

Even more learning about GANS

The GAN Zoo