Generative Adversarial Network (GAN) from scratch | PyTorch

Its a code heavy and rather in-depth course to master Generative Adversarial Network implementation.

GANs have been one of the most fascinating developments in Deep Learning and Machine Learning recently.

What you’ll learn

  • Learn how the basic principles of generative models work.
  • Build & Implement a GAN from scratch (Generative Adversarial Network) in Pytorch and Tensorflow.
  • How to improve the training stability of GANs.
  • Under the hood understanding of the Generator and Discriminator Mechanism.

Course Content

  • Conditional GAN From Scratch with PyTorch –> 2 lectures • 47min.
  • BiCycleGAN from Scratch with PyTorch –> 2 lectures • 58min.
  • DCGAN from Scratch with TensorFlow – Generate fake Faces from CelebA Dataset –> 3 lectures • 1hr 49min.
  • DCGAN From Scratch with PyTorch –> 1 lecture • 49min.
  • CycleGAN Paper Architecture Explanations –> 1 lecture • 32min.
  • CycleGAN from Scratch with PyTorch –> 1 lecture • 1hr 47min.
  • WGAN Architecture Paper Explanation –> 1 lecture • 26min.
  • WGAN Without Gradient Penalty from Scratch with PyTorch –> 1 lecture • 34min.
  • WGAN with Gradient_Penalty from Scratch with PyTorch –> 2 lectures • 1hr 21min.

Generative Adversarial Network (GAN) from scratch | PyTorch


GANs have been one of the most fascinating developments in Deep Learning and Machine Learning recently.


Also now the technologies around GAN have become so mature, that more and more Industries and Companies are adopting GAN to solve many of the regular problems. (Down below I have mentioned fa ew of them). And hence, the implementation from scratch of various GAN architectures, has also become one of the most frequent take-home exercise given by Companies before recruitment for Computer Vision / Deep Learning positions.

This is a code-heavy course and with a focus on really understanding and being able to implement the underlying architecture of the super famous GANs.


It’s a comprehensive seven and half hours (7.5 Hours) of video course to Generative Adversarial Networks (GANs) with each line of code explained while implementing them.

The theories are explained in-depth and in a friendly manner.


In this course, I have covered the following six Architecture.


  1. Conditional GAN
  2. DCGAN
  3. WGAN without Gradient Penalty
  4. WGAN WITH Gradient Penalty
  5. CycleGAN
  6. BiCycleGAN


All the source codes in Python are given as an attachment to each section and also as a zipped file for all of them together.

My courses are the ONLY courses where you will learn how to implement Generative Models machine learning algorithms from scratch


What Can Generative Models do?

Generating novel data samples such as images of non-existent people, animals, objects, etc. Not only images, but other types of media can be generated in this way as well (audio, text).


Image inpainting — restoring missing parts of images.

Image super-resolution — upscaling low-res images to high-res without noticeable upscaling artefacts.

Domain adaptation — making data from one domain resemble the data from the other domain (e.g. making a normal photo look like an oil painting while retaining the originally depicted content).


Denoising — removal of all kinds of noise from the data. For example, removing statistical noise from x-ray images fits medical needs, which will be described in our use cases.


GANs applications are able to solve different tasks:


Generate examples for Image Datasets

Image-to-Image Translation

Text-to-Image Translation

Semantic-Image-to-Photo Translation

Face Frontal View Generation

Generate New Human Poses

Photos to Emojis

Photograph Editing

Face Aging

Photo Blending

Super Resolution

Photo Inpainting

Clothing Translation

Video Prediction

3D Object Generation

By the end you’ll be able to

• Build and train not only the 6 Different GAN Networks covered in this course, but will be able to extend this knowledge to be able to implement various other GAN architecture.

Suggested Prerequisites:

  • Python
  • The concept of Gradient descent
  • Some familiarity with how to build a feedforward and convolutional neural network in PyTorch and TensorFlow


Mostly, each of the GAN architectures are independently developed. So basically you can follow each of the 6 GANs implementations independently. However, if you are rather new to the conceptes of Convolutional Neural Network and the very fundamentals of Deep Neural Network, then I suggest to start with DCGAN (which is the simplest among them all ).

Get Tutorial