Skip to content

Convolutional Neural Network (CNN) model for recognizing handwritten digits

Notifications You must be signed in to change notification settings

siennaphia/digitRecognizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Handwritten Digit Recognition using Convolutional Neural Networks (CNN)

In this project, I developed a Convolutional Neural Network (CNN) model using the Keras library to participate in the Kaggle competition "Digit Recognizer." The goal of the competition was to correctly classify images of handwritten digits into their respective numerical values (0-9).

Dataset

For this competition, the dataset provided by Kaggle consisted of 60,000 training examples and 10,000 testing examples from the MNIST dataset. Each image in the dataset is a grayscale 28x28 pixel image of a handwritten digit.

Model Architecture and Accuracy

The CNN model I designed achieved an impressive accuracy of 98% on the validation set. The model architecture is as follows:

  1. Convolutional Layers (Conv2D): The initial layers consisted of two Conv2D layers with 32 filters each, followed by two Conv2D layers with 64 filters each. These layers learned important features from the images by applying a set of learnable filters.

  2. Pooling Layers (MaxPool2D): To reduce computational cost and prevent overfitting, I incorporated MaxPool2D layers, which performed downsampling by selecting the maximum value from neighboring pixels.

  3. Dropout Layers (Dropout): Dropout regularization was used to prevent overfitting. A dropout rate of 0.25 was implemented, randomly ignoring a proportion of nodes during training to improve generalization.

  4. Flatten Layer (Flatten): The feature maps extracted from the previous layers were flattened into a 1D vector to prepare the data for the fully connected layers.

  5. Fully Connected Layers (Dense): The flattened features were passed through two fully connected Dense layers, acting as an artificial neural network (ANN) classifier. The final Dense layer had 10 neurons with softmax activation, producing a probability distribution for each digit class.

Training and Evaluation

I trained the model using the training set and applied data augmentation techniques to prevent overfitting. The training was conducted over 30 epochs with a batch size of 86. To monitor the model's performance, I used a validation set.

After training, I evaluated the model's accuracy on the validation set and obtained a remarkable accuracy of 98%. This accuracy indicates that the model is highly effective in classifying handwritten digits.

Conclusion and Learnings

Participating in the Kaggle competition "Digit Recognizer" allowed me to apply my knowledge of CNNs and deepen my understanding of their application to image classification tasks. I successfully developed a CNN model with a high accuracy rate of 98% on the validation set.

Throughout the project, I learned about various aspects of CNNs, including the importance of convolutional layers for feature extraction, the benefits of pooling layers for downsampling and reducing overfitting, and the effectiveness of dropout regularization in improving model generalization. Additionally, I gained practical experience in model evaluation, using validation data and analyzing accuracy.

This project demonstrates the potential of CNNs in accurately recognizing handwritten digits. The high accuracy achieved showcases the power of deep learning techniques in solving complex image classification problems.

About

Convolutional Neural Network (CNN) model for recognizing handwritten digits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published