This is a simple handwritten digit classifier which uses Convolutional Neural Network to classify the input image and predict the digit present in the image.
This project implements a simple Convolutional Neural Network (CNN) using TensorFlow and Keras to classify handwritten digits from the MNIST dataset. The trained model is saved as mark1.keras
.
- Uses a CNN model for handwritten digit recognition.
- Trained on the MNIST dataset with 10 epochs.
- Model is saved as
mark1.keras
for inference. - Includes a script to classify a given handwritten digit image.
-
Clone the repository:
git clone https://github.com/your-username/handwritten-digit-classification.git cd handwritten-digit-classification
-
Install dependencies:
pip install tensorflow numpy matplotlib pandas scikit-learn
To train the model, run:
python digit_classification.py
This will train the CNN on the MNIST dataset and save the model as mark1.keras
.
To classify a handwritten digit image, run:
python digit_class.py
Then enter the path to the image when prompted.
- 3 Convolutional Layers (with ReLU activation and max pooling)
- Flatten Layer
- Fully Connected Dense Layers
- Softmax Output Layer (for 10-class classification)
If you have an image digit.png
containing a handwritten digit, you can classify it as follows:
python digit_class.py
Then, enter:
path/to/digit.png
The script will output the predicted digit.
This project is licensed under the MIT License.