This project implements a Convolutional Neural Network (CNN) to classify handwritten digits from the MNIST dataset. The model is trained on a subset of the MNIST dataset consisting of 60,000 training images and tested on 12,000 test images.
- Python 3.10.0 ( any other version may work, try at your own discretion )
- TensorFlow 2.15.0
- Keras 2.15.0 ( separate from Tensorflow, issue on my side)
- Numpy 1.26.3
-
Clone this repository to your local machine:
git clone https://github.com/Ritesh-Sivanathan/mnist-classification-cnn.git
-
Navigate to the project directory:
cd mnist-classification-cnn
-
Install the required dependencies:
pip install -r requirements.txt
-
Navigate to the code directory
cd code
-
Train the model:
python train.py
This will train the CNN model using the MNIST training data.
-
Change to the model directory
cd ../model
-
Evaluate the model:
python evaluate.py
This will evaluate the trained model on the MNIST test data and display accuracy metrics.
After training and evaluating the model in model/evalulate.py
, you'll be shown the model accuracy. Feel free to tweak anything and everything to maximize the accuracy.
Some suggestions:
- Changing batch_size
line 20 - train.py
- Changing filter sizes in model
lines [25-34] - train.py
- Adding more image augmentation
lines [21 - ...] - preprocessor.py
The CNN architecture used in this project consists of:
- Input layer (1)
- Convolutional layers (3, Conv2D)
- Max pooling layers (2, MaxPooling2D)
- Flatten layer (1)
- Dense layers (2, relu and softmax activations)
- Output layer