Skip to content

This project implements a Generative Adversarial Network (GAN) from scratch in Keras & TensorFlow to generate realistic handwritten digits similar to the MNIST dataset.

Notifications You must be signed in to change notification settings

anikchand461/GAN-MNIST

Repository files navigation

Fake Handwritten digits generation using GAN over MNIST dataset

📌 Project Overview

This project implements a Generative Adversarial Network (GAN) from scratch in Keras & TensorFlow to generate realistic handwritten digits similar to the MNIST dataset.

A GAN consists of two neural networks trained together:

  • Generator: Learns to create synthetic digit images from random noise.
  • Discriminator: Learns to distinguish between real MNIST images and fake images created by the generator.

Both models compete, and over time the generator produces increasingly realistic digits.

🏗 GAN Architecture used here

Generator Discriminator
input epoch1

⚙️ Features

  • Custom-built Generator and Discriminator networks using TensorFlow/Keras.
  • Training loop with tf.GradientTape.
  • Model checkpointing to resume or reuse training.
  • Visualization of generated digits per epoch.
  • Creation of a GIF animation showing generator progress.
  • Export of all generated images (epochs 1–100) into a single ZIP archive.

📊 Results (Generated Fake Images)

Input Epoch 1
input epoch1
Epoch 2 Epoch 3
input epoch1
Epoch 9 Epoch 17
input epoch1
Epoch 25 Epoch 50
epoch25 epoch50
Epoch 75 Epoch 100
epoch75 epoch100

Example (Generated Digits Progress)

alt text


Real MNIST images:

alt text

📈 Possible Improvements

  • Implement FID (Fréchet Inception Distance) or Inception Score for evaluation.
  • Explore deeper architectures for generator and discriminator.
  • Extend GAN training to color image datasets (e.g., CIFAR-10).
  • Try Conditional GANs (cGANs) to generate specific digits.

About

This project implements a Generative Adversarial Network (GAN) from scratch in Keras & TensorFlow to generate realistic handwritten digits similar to the MNIST dataset.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published