Digit recognition project using CNN (Convolutional Neural Networks) and KNN (K-Nearest Neighbors) models.
The models are used to recognize handwritten digits using the MNIST dataset, and it can be viewed on Streamlit app
The MNIST dataset is widely used in the field of image recognition, containing 60,000 training images and 10,000 test images of digits from 0 to 9.
CNNs are neural networks designed to process data with a grid-like structure, such as images. Typically, three convolutional layers are used to extract features from the images:
- Convolutional Layers: use filters to identify patterns in the images.
- Pooling Layers: reduce dimensionality while preserving important features.
- Fully Connected Layers: perform the final classification.
KNN is a supervised learning algorithm that classifies new samples based on the majority vote of their k-nearest neighbors (7 neighbors provided the best results in the tests and was the value used). A distance metric is used to identify the nearest neighbors (we used Euclidean distance in the model), and classification is based on the most common class among the k-nearest neighbors.
CNN: Achieved an accuracy of 98.97%
KNN: Despite being simpler, the model also achieved a good result with 96.94% accuracy.
MNIST database: MNIST database
CNN: Convolutional Neural Networks Explained
KNN: Machine Learning Basics with the K-Nearest Neighbors Algorithm
