Belong to set of algorithms named generative models. Belong to unsupervised learning.
Application : Text / Image / Video Generation , Text-to-image synthesis
GANs consists of a pair of neural networks that fight with each other. One is called generator and another one is called discriminator.
How to tell computer to differentiate between faces and non-faces?
-Faces: Top Left and Bottom Right have the big values(dark pixels) whereas the other two corners has small values(light pixels).
-Noisy : Any values fall inside (range 0 to 1).
Method : Add the two values correspoonding and subtract the values corresponding to other two corners.
For faces, the end result value is high and for non-faces, the end result value is low. Threshold = 1 More than 1: face. Less than 1 : no face.
This is a good generator and able to generate the faces as the end value result is high and also the value for top left and bottom right are always big and the values for the corresponding value are smalls.
First taking data point and perform forward pass, calculate prediction and calculate error based on log loss, take the derivative of the error based on all weight using chain rule to tell us how much to obtain each weight in order to best decrease the error (gradient descent). Plot the error and calculate gradient which is the direction of greatest growth and then take a tiny step in the direction of negative of this gradient in order to find new parameter that decrease error as much as possible.
Set the random z value (between 0 and 1) as input to generator, do a forward pass to obtain some image which is probably face (generated image). Then pass generated images to discriminator to tell is fake or real. Discriminator output probability.
Since the number is random and not face and the image generated by generator, the discriminator should saying is fake (want Output 0). The generator want to generate an image so good so that discriminator classifies as real (want output 1). That both error function helps to train the neural network. The derivatives of both help to update weights of both neural network. The two error functions are fighting each other but is okay because red error function is changing the generator weigths and blue error functions is changing the discriminator weights therefore they dont coliide and simply improve both neural networks.
pick a random Z value > apply generator to produce fake image > apply image to discriminator > backpropagation to update weights on both generator and discriminator > take real image and plugin to discriminator and update weights again using backpropagation





















