Skip to content

GenAI-EvenMNIST harnesses generative AI through a Variational Auto-Encoder (VAE) with convolutional layers to generate even-digit images from the MNIST dataset. This project showcases the application of AI for image creation and deep learning

Notifications You must be signed in to change notification settings

SatvikVarshney/GenAI-EvenMNIST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GenAI-EvenMNIST

Overview

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.

Features

  • 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.

Results

Sample outputs of generated images

These Images are generated based on hand written characters as stored in the MNIST database

0 2 4 6 8
image image image image image
image image image image image
image image image image image

Training Loss Results

Loss

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.

Getting Started

Prerequisites

  • Python 3.x
  • PyTorch
  • NumPy
  • Matplotlib

Data Files

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.

Configuration Files

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
}

Installation

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

Command line syntax to run main.py

python main.py -o results -n 100
OR
python main.py --help

Command line parameters description

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

About

GenAI-EvenMNIST harnesses generative AI through a Variational Auto-Encoder (VAE) with convolutional layers to generate even-digit images from the MNIST dataset. This project showcases the application of AI for image creation and deep learning

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages