Skip to content

Uday-Polineni/CNN-Number-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  MNIST Digit Classification using TensorFlow & Keras

This project demonstrates handwritten digit classification on the MNIST dataset using TensorFlow and Keras. Multiple neural network architectures are implemented and compared to show how model depth and feature handling affect accuracy.

๐Ÿ“Œ Project Overview Dataset: MNIST (28ร—28 grayscale images of digits 0โ€“9) Framework: TensorFlow / Keras Language: Python Evaluation: Accuracy & Confusion Matrix The project progressively improves the model: Simple logistic regression One hidden layer neural network Neural network with automatic flattening

๐Ÿ—‚๏ธ Dataset Details Training samples: 60,000 Test samples: 10,000 Image size: 28 ร— 28 Labels: 0โ€“9 Each image is normalized by dividing pixel values by 255.

๐Ÿงช Model Experiments๐Ÿ”น Model 1: Logistic Regression (Baseline) Input Layer (784) โ†“ Dense(10) with Sigmoid Input flattened manually Loss: sparse_categorical_crossentropy Optimizer: Adam Epochs: 5

๐Ÿ“‰ Observation: Struggles with visually similar digits like 5 vs 7 and 8 vs 9 ๐Ÿ”น Model 2: One Hidden Layer Neural Network Input (784) โ†“ Dense(100) with ReLU โ†“ Dense(10) with Sigmoid

Adds non-linearity Better feature extraction Epochs: 5

๐Ÿ“ˆ Improvement: Higher accuracy Reduced misclassifications Cleaner confusion matrix ๐Ÿ”น Model 3: Flatten Layer + Hidden Layer (Best Model) Flatten(28ร—28) โ†“ Dense(100) with ReLU โ†“ Dense(10) with Sigmoid

No manual reshaping needed Cleaner architecture Epochs: 10

๐Ÿ† Best performance among all models

๐Ÿ“Š Results & Visualizations Sample Predictions Correct classification of handwritten digits Visual examples include digits 5 and 7 Confusion Matrices Heatmaps created using Seaborn Shows class-wise prediction accuracy Clearly highlights improvements across models Confusion matrices demonstrate fewer off-diagonal errors as model complexity increases.

๐Ÿ› ๏ธ Tech Stack Python TensorFlow / Keras NumPy Matplotlib Seaborn

๐Ÿš€ How to Run pip install tensorflow numpy matplotlib seaborn python mnist_classifier.py

๐Ÿ“Œ Key Learnings Importance of hidden layers for non-linear data Effect of feature flattening How confusion matrices help diagnose model weaknesses Progressive improvement through architectural changes

๐Ÿ“Ž Future Improvements Replace sigmoid with softmax in output layer Add Dropout for regularization Try CNNs for spatial feature learning Hyperparameter tuning

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages