Build a Deep Convolutional Generative Adversarial Network with PyTorch to generate handwritten digits
The requirements.txt
file should list all Python libraries that our models depends on, and they will be installed using:
pip install -r requirements.txt
In this project, we will implement Deep Convolutional Generative Adversarial Network (DCGAN)
using PyTorch to generate handwritten digits. You will create a generator that will learn to generate images that look real and a discriminator that will learn to tell real images apart from fakes.
Generative Adversarial Network (GAN) is a famous neural network model, its function is to input a set of noise and then generate a set of fake pictures through the Generator, and then use the Discriminator to distinguish whether it is a real picture.
First train a simple Discriminator classifier, and then train a Generator. The two models fight and train repeatedly, and finally take the trained Generator model. We can randomly generate noise and generate pictures at will!
The notebook of project is divided on parts that are :
- Configurations
- Load MNIST Handwritten Dataset
- Load Dataset into Batches
- Create Discriminator Network
- Create Generator Network
- Create Loss Function and Load Optimizers
- Training GAN Model
- Model Evaluation
- Generator and Discriminator Loss During Training :
- Progression of Generation of Handwritten Digits During Training :
After 8000 batches, the generator started to generate real numbers as seen in the figures above.
- Real and Fake Handwritten Digits Perception After Training :
- Random Generation of Handwritten Digits After Training :
Zakaria Mejdoul
Enjoy generating and classifying handwritten digits ❗ ✌️