This project implements a Deep Convolutional Generative Adversarial Network (DCGAN) to generate handwritten digit images using the MNIST dataset. The DCGAN consists of a generator and a discriminator, trained together in an adversarial manner.
- Python 3.x
- TensorFlow
- Keras
- NumPy
- Matplotlib
Karavatt_05_01.py
: Main script implementing the DCGAN model for generating digit images.generated_images
: Directory to save the generated images during training.generator.h5
: Saved trained generator model for future image generation.
- Ensure all required dependencies are installed.
- Run the
Karavatt_05_01.py
script to train the DCGAN on the MNIST dataset. - Trained model and generated images will be saved in the project directory.
- Generator: Builds fake images from random noise vectors.
- Discriminator: Distinguishes between real and fake images.
- DCGAN Model: Combines the generator and discriminator into a single model for training.
- Training Callback: Generates sample images during training for visualization.
- Load the MNIST dataset and preprocess the images.
- Build the discriminator and generator models.
- Compile the DCGAN model with appropriate optimizers and loss function.
- Train the DCGAN on the MNIST dataset for a specified number of epochs.
- Save the trained generator model for future image generation.
- Real Images: A sample of 10 real images from the MNIST dataset.
- Generated Images: Images generated by the trained generator model during the training process.
The DCGAN is capable of generating realistic-looking handwritten digit images resembling those from the MNIST dataset. The generated images exhibit similar characteristics to the real images, demonstrating the effectiveness of the DCGAN architecture for image generation tasks.