A PyTorch implementation of a Generative Adversarial Network (GAN) trained on the MNIST dataset. Have a fun with it here
This project implements a GAN to generate handwritten digits similar to those in the MNIST dataset. The architecture includes:
- A Generator that creates fake images from random noise
- A Discriminator that tries to distinguish between real and fake images
torch>=2.0.0
torchvision>=0.15.0
matplotlib>=3.5.0
tqdm>=4.65.0
- Clone the repository:
git clone https://github.com/tveshas/mnist-gan.git
cd mnist-gan- Install dependencies:
pip install -r requirements.txt- Run the training:
python my_gan.pymy_gan.py: Main implementation file containing GAN architecture and training loopmy_gan.ipynb: Jupyter notebook version with visualizations and explanations
- Generator: Multi-layer perceptron with batch normalization and ReLU activation
- Discriminator: Multi-layer perceptron with LeakyReLU activation
- Input dimension: 784 (28x28 MNIST images)
- Latent dimension: 64
MIT License
This implementation is based on the original GAN paper by Goodfellow et al.