Basics of Generative Adversarial Networks (GANs) (original) (raw)

Last Updated : 15 Jun, 2026

Generative Adversarial Networks (GANs) are a deep learning technique used in generative modeling to learn patterns from existing data and create new, similar samples. They achieve this through a competitive training process involving two neural networks that improve each other over time.

Key Components

Generative Adversarial Networks (GANs) consist of two main components that work together in a competitive manner:

Example

The Generator generates some random images (eg. tables) and then the discriminator compares those images with some real world table images and sends the feedback to itself and Generator, helping the Generator create better, more realistic images over time. Let's see GAN structure below.

**Working of GAN

GAN structure

**Step 1: Training the Discriminator

**1. Initial Generator Output: The Generator creates random images from noise. Initially, these images do not resemble real dogs.

**2. Discriminator Input: The Discriminator is shown two sets of images:

**3. Discriminator’s Evaluation: The Discriminator assigns a probability to each image, indicating how likely it is to be real.

**4. Loss Calculation: The Discriminator aims to label real images as **1 and generated images as **0. The loss is calculated by comparing the predicted probabilities with the correct values.

**5. Backpropagation: After calculating the loss, the Discriminator’s weights are adjusted to improve its ability to distinguish real from fake images.

GAN Step 1

**Step 2: Training the Generator

After the Discriminator is trained, the Generator is updated.

After several iterations, the Generator gradually learns to create images that closely resemble real-world dog images.

GAN Step 2

**Applications

Advantages

Challenges