Generative Adversarial Network


I share my knowledge about GAN for the readers who want to know about Generating images for the various domains. Here you can get a brief about the Deep Learning, its architecture, layers and their real-time applications like a deep dream and their working and also How GANs are playing a significant role in e-commerce, the algorithms used and few real-time applications. So you people really enjoy the GAN feast after reading this article. I assure that you will get a good knowledge about the deep neural network.

What is GANs?

Generative Adversarial Network is one of the classes in the AI algorithm used in unsupervised learning.  It is the subset of Deep Learning. It consists of two deep neural networks called Generator and Discriminator. Nowadays, generating images or patterns is essential for the market.

Why we should know about GAN?

Generating the images for animation, the pharmaceutical industry, e-commerce etc. For actively generating the patterns, featuring the specific objectives GAN can efficiently generate images on their own. As it comes under Deep learning, both feature extraction and classification are performed on their own, so GANs are purposely used for many applications.

In this, we are going to see about Deep Neural Network because it consists of the Input layer, Outan put a layer and some Hidden Layers. The number of Iterations performed will sharpen the generated patterns.

Deep Neural Network

Deep Neural Network consists of various hidden layers. It consists of an input layer, output layer, and at least one hidden layer. These layers are trained with DL algorithms. The layers are Input layer, Convolution layer, ReLu layer, Pooling layer, fully connected layer, Softmax layer, and an Output layer. The accuracy of the output is improved by improving the number of Iterations.


GAN consists of Two deep learning modules. They are GENERATOR and DISCRIMINATOR. Let us see the prominent role of the modules.


It is a class of ML module. It is the network which generates fake images. Depend upon the given random noise of input of images, it extracts features from it by learning identity. Backpropagation helps in making better images. It efficiently generates images with smaller no. of the parameter. Fake images try to confuse discriminator with diverse samples.


Based on the original input, it is trained to detect the real image. It is trained to correctly classify a given input image as real (coming from training dataset images) or fake (synthetic image produced by generator). It is a typical CNN image classifier i.e. a binary image classifier. It is the reverse of generator i.e. based on the image it spits off different classes as output and backpropagation is used


In GAN, there are many layers which actually sharpen the pattern generated. Here we see about those layers.

Input Layer

It is a large database of handwritten digits is commonly used for training and testing in image processing.  Random noise is given as input to the generator model.

Convolution layer

It applies convolution to the input i.e. passing the result to the next layer. It is one of the hidden layers. CNN with deconvolution layers used for Generator model. Deconvolution layers are the reverse of CNN.

ReLu layer

It is the Rectified linear unit, an activation function. The negative values are taken as zero, only Positive values are considered.

Pooling layer

There are two known types of pooling. Average pooling (uses the average value from the matrix) and max-pooling (maximum value).

Fully connected layer

The pooled layer goes through a fully connected layer to classify images based on the random noise.

Softmax layer

A normalized exponential function takes an input and normalizes to a probability function

Output layer

Thus the output layer is the combination of convolution, pooling, fully connected and softmax layers.

Join our weekly newsletter to receive:

  1. Latest articles & interviews
  2. AI events: updates, free passes and discount codes
  3. Opportunities to join AI Time Journal initiatives



Deep Dream

The deep dream is a computer vision program created by Google engine uses CNN to find and enhance pattern in images via algorithmic pareidolia thus creating a dream-like hallucinogenic appearance in the deliberately over processed images. Dreaming is to refer to the generation of images that produce desired activations in a trained network. The software is designed to detect faces and other patterns in images, with the aim of automatically classifying images. Once trained, the network can also be run in reverse, being asked to adjust the original image so that a given output neuron yield a higher confidence score.

Cycle GAN

The images are converted from one domain to another i.e. real image from the data set altering the nearby pixels in RGB, the “Fake” images i.e. patterns are generated.


Companies like Amazon, Flipkart, Snapdeal, process billions of orders every day. Among the billions there are only a small fraction of orders are plausible. Increasing e-orders ensures customers reliance. The structure is imposed by product categories, price ranges, brands, manufacturers, etc. on the company side. Likewise, on the customer side, customers are grouped together based on purchase behaviors, price/brand sensitivity, ethnicity, etc.

In these various entities, customer involved is and the products. Based on the given features of plausible orders, the GAN’s Generator itself generates orders for e-commerce websites. It mimics all possible purchase views


  •     1. Creating a dense and low-dimensional representation of e-commerce orders.
  •    2. Train the e-commerce GAN with real orders to show the feasibility.
  •   3. Train an e-commerce conditional GAN to generate plausible orders for a particular product.

Order Representation

It is important to learn dense, low -dimensional representations of orders for using them in GAN. We represent each order as a tuple of customer, product, price, date.

Each component in the tuple is represented as a dense and low-dimension vector. The weight of the upcoming product in the market is created on its own by the unsupervised approach.

The word2vec corpus is used to bring similar products close to us.


We introduce Wasserstein GAN to improve the stability of learning, to avoid mode collapse and provide meaningful learning curves useful for debugging and hyperparameter searches. It uses Earth- Mover’s distance to measure the distance between the actual and generated distribution. An optimal discriminator produces good information for the generator to improve. We are using the cost function indifference with GAN.

e-commerce conditional GAN

It involves generating orders conditioned on a particular product. This is done by feeding the data which is to be conditioned both by generator and discriminator. The generator learns to generate fake orders with a specific condition or marketing features. We can predict the target customers, they can be targeted with personalized deals and recommendations.

Likewise, better estimations of demand and sales can help us in making supply decisions. Evaluation can be done by Random forest classification. The shopping preferences of the customer are predicted based on the identified product category.

On comparing with Conditional Variational Autoencoder, e-conditional GAN performs well.

We go for WGAN for minimizing the mode collapse.

Wasserstein GAN

Mode collapse is that when several noise vectors point the same output, then the diversity of samples generated decreases. So WGAN is used. It measures the distance or divergence between the real and fake data distribution. The Wasserstein distance is the minimum distance or mass in converting the data from one distribution to another. That’s how the plausible orders are generated by the generator and its reliability is being checked by the discriminator.


  • 1. No sign of mode collapse
  • 2. The learning of the Generator is not stopped


We have seen the Generative Adversarial Network often called as GAN which is the pattern generating network under the Deep learning class, a subset of AI. Deep Neural Network and its architecture are discussed well with its layers and their functions. Finally, I discussed the real-time applications like Deep Dream and the role played by GAN in e-commerce and the algorithms used.

I am interested in doing research on How AI can be applied in Traffic system using OpenCV. In that, we process the image captured by the Camera we used. There is a difference between GAN and OpenCV. GAN generates the given patterns while OpenCV preprocessed images. I have also interested in your comments. Share your view about this article via email:

Opinions expressed by contributors are their own.

About Ebin Rose Christina

Editorial Staff Intern Student @ Pandian Saraswathi Yadav Engineering College

View all posts by Ebin Rose Christina →