Team size: 4 people
- Project Field: Computer Vision, Image Processing, Convolution Neutral Network, K-Nearest Neighbour, Classification Problem.
This project explores and compares two machine learning approaches—K Nearest Neighbors (KNN) and Convolutional Neural Networks (CNN)—for classifying handwritten digits from the MNIST dataset and human-generated input. It includes experiments on distance metrics, filter configurations, dropout rates, and model size. A custom GUI tool is also provided for users to draw digits and evaluate model performance on real-time human input. The source code for GUI tool is in this repository, the experiments is conducted through Kaggle.
The following Kaggle notebooks were used for experiments and comparisons:
- Compare Model: A notebook comparing the performance of KNN and CNN on human generated data.
- Intro to CNN: A notebook exploring Convolutional Neural Networks (CNN) for digit classification.
- Intro to KNN: A notebook exploring k-Nearest Neighbors (KNN) for digit classification.
- The main application file for the digit recognition GUI.
- Allows users to draw digits on a canvas and predicts the digit using a pre-trained CNN model (
final_model.h5
).
- Provides a utility for drawing and saving digit images.
- Includes functionality to save drawn digits as 28x28 grayscale images in a CSV file.
- Displays digit images from a CSV file (
digit_data1.csv
). - Visualizes the pixel data and corresponding labels.
- Loads and visualizes digit images from the MNIST dataset.
- Useful for understanding the structure of the dataset.
- Lists the Python dependencies required to run the project.
- A CSV file containing centerd and rezized human generated digit data, including labels and pixel values.
- The pre-trained CNN model used for digit recognition.
Since tensorflow doesn't support python 3.13, we need to create a virtual enviroment to install tensorflow. If you are using python 3.12 or older, you don't need to create a virtual enviroment.
-
Create a virtual environment with Python 3.11:
python3.11 -m venv .venv
-
Activate the virtual environment:
- On Windows:
.venv\\Scripts\\activate
- On Linux/Mac:
source .venv/bin/activate
- On Windows:
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the main application:
python main.py