A Pytorch implemetation of DCGAN on the MNIST dataset.
DCGAN or Deep Convolutional GAN are a special type of GAN architecture where discriminator and generator are both CNNs. They can be used for many generative tasks and give better results compared to vanilla GAN's.
Here developed the DCGAN from scratch and trained on MNIST dataset to generate fake handwritten digits.
The project implementation follows the paper on DCGAN
The MNIST dataset of handwritten digits was used for the project and is available publicly
The GAN architecture is shown in the figure below. As this is DCGAN so both generator and discriminator are CNN's
Generator is a CNN with ConvTranspose operations which generates fake handwritten digits(Dimension:1X64X64) from some random noise
Discriminator is also a CNN with Convolution operations which takes a image as input(Dimension:1X64X64) and classify whether the image it received is a real one or fake generated one.
Generator and Discriminator architecture is in the below figure
LEARNING_RATE=2e-4
BATCH_SIZE = 128
IMAGE_SIZE = 64
CHANNELS_IMG = 1(MNIST dataset image has only 1 channel)
NOISE_DIM = 100
NUM_EPOCHS = 100
FEATURES_DISC = 64
FEATURES_GEN = 64
The model was trained for 30 epochs in adversarial manner and then it was abled to generate decent images,some of them are below
DCGAN paper:[https://arxiv.org/abs/1511.06434v1]