Building and training GAN models with TensorFlow
In general, a GAN model has two neural networks: G for the generator and D for the discriminator. x is some real data input from the training set, and z is random input noise. During the training, D(x) is the probability of x being real and D tries to make D(x) close to 1; G(z) is the generated output with the random input z, and D tries to make D(G(z)) close to 0, but at the same time, G tries to make D(G(z)) close to 1. Now, let's first see how we can build a basic GAN model in TensorFlow and Python that can write or generate handwritten digits.
Basic GAN model of generating handwritten digits
The training model for handwritten digits is based on the repo https://github.com/jeffxtang/generative-adversarial-networks, which is a fork of https://github.com/jonbruner/generative-adversarial-networks, with added script that shows generated digits and saves the TensorFlow trained model with an input placeholder, so our iOS and Android apps can use...