This project demonstrates the implementation of the LeNet-5 convolutional neural network for handwritten digit recognition using the MNIST dataset.
The project is organized as follows:
main.py
: Contains the main script to train and evaluate the LeNet-5 model.model.py
: Defines the LeNet-5 model architecture.utils.py
: Provides utility functions for data loading, preprocessing, and evaluation.requirements.txt
: Lists the required dependencies for running the project.
- Prepare the dataset:
- Download the MNIST dataset and place it in the appropriate directory.
- Ensure the dataset is properly split into training and validation sets.
- Train the model:
- Adjust the
data_path
argument according to the location of your dataset. - Optionally, specify other training parameters such as learning rate, batch size, etc.
- Evaluate the model:
- Adjust the
data_path
argument according to the location of your dataset.
- Predict using the trained model:
- Modify the
inference()
function inutils.py
to accept and process the input image. - Use the modified function to make predictions on new images.
- For a given input image, the model predicted the digit as 8 with a probability of 99%. predicted: 8, prob: 99.9998927116394 %
- The MNIST dataset is used for training and evaluation.