The GenAI-EvenMNIST project uses a Variational Auto-Encoder (VAE) with convolutional layers to generate images of even digits from the MNIST dataset. By leveraging generative AI, this project aims to explore the capabilities of neural networks in synthesizing digit images that resemble handwritten examples. It focuses on the intricate process of learning data distributions and generating new, unseen images through the lens of deep learning.
- Even MNIST Dataset Preparation: Utilizes a modified version of the MNIST dataset, focusing exclusively on even digits, resized for efficient processing.
- Convolutional VAE: Implements a VAE with convolutional layers tailored for image data, capable of learning complex patterns in digit images.
- Image Generation: After training, the model can generate new digit images based on learned distributions, showcasing the potential of generative AI.
- Performance Visualization: Includes loss metrics visualization to assess the model's training progress and convergence.
- Verbose Mode: Offers iterative reports on the model's learning progress, enhancing transparency and understanding of the training process.
0 | 2 | 4 | 6 | 8 |
---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The graph above illustrates the VAE's training loss over epochs. The model starts with a higher loss which quickly decreases, indicating effective learning. As the epochs progress, the loss continues to diminish, suggesting that the model is improving its ability to generate even MNIST digits with a consistent decline towards convergence.
- Python 3.x
- PyTorch
- NumPy
- Matplotlib
The dataset, even_mnist.csv
, consists of MNIST digit images that have been filtered to include only even numbers and resized to 14x14 pixels. It's located in the data/
directory.
Model hyperparameters and operational parameters can be adjusted in a JSON configuration file. The configurations include learning rate, number of training epochs, batch size, and latent space dimensions.
Example param.json
:
{
"learning rate": 0.001,
"num iter": 5,
"batch_size" : 128,
"latent_dim": 64,
"verbose_mode" : 1,
"img_dim": 14
}
Clone the repository to get started:
git clone https://github.com/SatvikVarshney/GenAI-EvenMNIST.git
Navigate to the project directory:
cd GenAI-EvenMNIST
Install the required Python packages:
pip install -r requirements.txt
python main.py -o results -n 100
OR
python main.py --help
Parameter 1 = -o results
Parameter 1 description = Folder path to store the regerenated images and loss plot
Parameter 1 default value = results
Parameter 1 type = string
Parameter 2 = -n 100
Parameter 2 description = Count of the regenerated output files
Parameter 2 default value = 100
Parameter 3 type = interger