This repository is dedicated to the exploration and implementation of neural network models for the recognition of handwritten digits using the MNIST dataset. It features two primary models: an Artificial Neural Network (ANN) and a Convolutional Neural Network (CNN), both designed to classify digits from 0 to 9 with high accuracy. The project leverages deep learning techniques to address common challenges in image recognition tasks.
The motivation behind this project is to demonstrate the effectiveness of neural networks, particularly CNNs, in image classification tasks. By training models on the MNIST dataset, we aim to showcase the potential of neural networks to learn complex patterns and make accurate predictions, serving as a foundational step for more advanced image recognition applications.
The MNIST dataset, a large database of handwritten digits, is used for training and testing the models. It includes:
- 60,000 training examples
- 10,000 testing examples: Each image is size-normalized and centered in a fixed-size (28x28 pixels) frame.
Note: More information about the dataset can be found here.
- Python
- TensorFlow/Keras
- NumPy
- Matplotlib
- Implementation of an ANN with two dense layers.
- Implementation of a CNN with two convolutional layers and max pooling layers.
- Evaluation of models using accuracy metrics and confusion matrices.
- Visualization of training and validation loss and accuracy to analyze model performance.
The performance of the models is summarized as follows:
-
ANN Model:
- Test Accuracy: Approximately 97.84%
-
CNN Model:
- Test Accuracy: Approximately 98.86%
- Enhanced accuracy with the addition of max pooling layers.
-
CNN with Pooling:
- Test Accuracy: Approximately 99.14%
Discussion on overfitting and underfitting issues, as well as the impact of network architecture modifications, are included in the training logs.
To set up this project for use or development, follow these steps:
- Clone the repository:
git clone https://github.com/spymavro/Artificial-Neural-Network-Convolutional-Neural-Network-Models.git cd Artificial-Neural-Network-Convolutional-Neural-Network-Models
- Install the required Python packages:
- Ensure you have Python installed on your system. If not, download and install it from python.org.
- It's recommended to create a virtual environment to keep dependencies required by different projects separate and to avoid conflicts:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install the required packages:
pip install tensorflow numpy matplotlib
- Proceed with project setup and usage as required:
- Step 1: Cloning the repository is straightforward; make sure to replace
spymavro
with your actual GitHub username. - Step 2: This step covers:
- Checking for Python installation.
- Setting up a virtual environment, which is optional but recommended.
- Direct installation of each required Python package using
pip
.
- Navigate to the cloned directory in your terminal and execute the ANN and CNN models script by running:
python ann_cnn.py
For any inquiries or collaboration requests, please reach out via GitHub or email at [email protected].