Generative Adversarial Networks
Programming

Generative Adversarial Networks

Generative Adversarial Networks

Generative Adversarial Networks, or GANs for short, are an approach to generative modeling using deep learning methods, such as convolutional neural networks. Consisting of 2 sub models (Generator - Discriminator) to execute its job.

Generative modeling is an unsupervised learning in machine learning that involves automatically detect and learning the patterns in input data in such a way that the model can be used to generate or output new examples that plausibly could have been drawn from the original dataset.

for farther understanding let's recipe the difference between the supervised and unsupervised learning in machine learning, and moving forward to visualizing the diagram of the generative adversarial network.

Supervised Vs Unsupervised



As in photo the supervised learning has advantage of knowledge on the unsupervised one, meaning the supervised should know what it will be inputted to its model so he can make prediction or decision. Unlike of unsupervised learning the model should detect and learning the patterns in input data.

                                

Following table make really practical summery for such a point.

Basis For ComparisonsSupervised LearningUnsupervised Learning
 

Method

Input variables and output variables will be given.Only input data will be given
 

Goal

Supervised learning goal is to determine the function so well that when new input data set given, can predict the output.The unsupervised learning goal is to model the hidden patterns or underlying structure in the given input data in order to learn about the data.
 

Class

Machine learning Problems, Data Mining  and Neural Network,Machine Learning, Data Mining, Problems and Neural Network
 

 

Examples

  • Classification
  • Regression
  • Linear regression
  • Support vector machine
  • Clustering
  • Association
  • k-means
  • Association
Who usesData scientistsData scientists
 

Eco-systems

 

Big data Processing, Data mining.

Big data Processing, Data mining.
 

 

Uses

 

Supervised learning is often used for export systems in image recognition, speech recognition, forecasting, financial analysis and training neural networks and decision trees etc...


Unsupervised learning algorithms are used to pre-process the data, during exploratory analysis or to pre-train supervised learning algorithms.


Generative adversarial networks

 

let's move to next point generative adversarial networks or for short (GAN) ok, lets visualize the normal shape of any AI model. Like we said in the first section it is unsupervised learning mostly working with photos. the name of the technique is good point to start.

                        Generative                                                                Adversarial                                                   Networks                      

Generation model its operation to generate a fake           |           Generator and discriminator is competing to win.           |          The network options is several but most commonly
data to compete with the discriminator model to               |           Generator trying to create fake data, discriminator         |          deep convolutional or fully connected networks.
convince discriminator model, the fake data is so             |           not to be fooled.                                                              |
like the real one.                                                                |                                                                                                   |

  • Generator. Model that is used to generate new plausible examples from the problem domain.
  • Discriminator. Model that is used to classify examples as real (from the domain) or fake (generated).




Generator Model


The generator model takes a fixed-length random vector as input (Latent Vector) and generates a sample in the domain.


This vector space is referred to as a latent space or latent vector comprised of latent vector. Latent variables, or hidden variables, are those variables that are important for a domain but are not directly observable.

''A latent variable is a random variable that we cannot observe directly.''

We often refer to latent variables, or a latent space, as a projection or compression of a data distribution. That is, a latent space provides a compression or high level concepts of the observed raw data such as the input data distribution. In the case of GAN, the generator model applies meaning to points in a chosen latent space, such that new points drawn from the latent space can be provided to the generator model as input and used to generate new and different output.

''Machine-learning models can learn the statistical latent space of images, music, and stories, and they can then sample from this space, creating new artworks with characteristics similar to those the model has seen in its training data.''

After training, the generator model is kept and used to generate new samples.


Discriminator model


The discriminator model takes an example from the domain as input (real or generated) and predicts a binary class way detection of real or fake (generated) digital data.

The real example comes from the training dataset. The generated examples are output by the generator model.

The discriminator is a normal referred as classification model.

After the training process, the discriminator model is neglected then we are interested in the generator to be more accurate.

Sometimes, the generator can be repurposed as it has learned to effectively extract features from data in the problem domain. Some or all of the feature extraction layers can be used in transfer learning applications using the same or similar input data.


GANs as Sport of Two Player Game


As we study in the previous sections the generative modeling is unsupervised learning problem, as smart as the architecture of the GAN see the problem as supervised learning thanks to the combination of the generator and discriminator models.

''We can think of the generator as being like a counterfeiter, trying to make fake money, and the discriminator as being like police, trying to allow legitimate money and catch counterfeit money. To succeed in this game, the counterfeiter must learn to make money that is indistinguishable from genuine money, and the generator network must learn to create samples that are drawn from the same distribution as the training data.''

The two models, the generator and discriminator, are trained together. The generator generates a batch of data samples, and these, along with real examples from the domain, are provided to the discriminator and classified as real or fake.

The discriminator is updated to get better at discriminating real and fake data in the next round, the generator is updated based on how well, or not, the generated samples fooled the discriminator.

So we see the problem of generate new data and validate this data as the game of 2 player competing with each other to win the game.


5-steps of GAN


1.Define GAN architecture based on the application

2.Train discriminator to distinguish real vs fake data

3.Train the generator to fake data that can fool the discriminator

4.Continue discriminator and generator training for multiple epochs

5.Save generator model to create new, realistic fake data


Application of the GAN


- Video frame predication.

- Image Enhancement

- Encryption algorithms 


You can use the model through:-


https://this-person-does-not-exist.com/en

https://thispersondoesnotexist.com

  • Mohammed Saied
  • Mar, 25 2022

Add New Comments

Please login in order to make a comment.

Recent Comments

Be the first to start engaging with the bis blog.