This intelligent web application leverages cutting-edge deep learning to instantly recognize handwritten digits. Built on a sophisticated Convolutional Neural Network architecture powered by PyTorch, the system delivers exceptional accuracy (98%+) through training on the comprehensive MNIST dataset. Experience seamless digit recognition through an elegant, user-friendly interface.
- Deep CNN implementation with optimized layer configurations
- Comprehensive training pipeline with real-time performance monitoring
- Detailed analytics including confusion matrices and performance metrics
- Adaptive resizing and normalization algorithms
- Automatic color space conversion and inversion
- Sophisticated data augmentation for enhanced model resilience
- Live Canvas Drawing: Sketch digits directly on an interactive canvas with instant predictions
- File Upload Support: Seamlessly process images of handwritten digits
- Confidence Visualization: View top-3 predictions with detailed probability scores
- Responsive Design: Sleek, minimalist UI optimized for all devices
- Centralized hyperparameter management via
config.py - Easy customization of model and application settings
- Python 3.8 or higher
- pip package manager
1. Clone the Repository
git clone https://github.com/dineshbarri/Neural_Digit_Recognizer
cd Neural_Digit_Neural_Digit_Recognizer2. Install Required Dependencies
pip install -r requirements.txtAll essential packages including PyTorch, Flask, and image processing libraries will be installed automatically.
3. Train the Neural Network (Recommended for optimal performance)
python train_model.pyThis process will:
- Train the CNN on MNIST dataset
- Generate
mnist_model.pthwith optimized weights - Create performance analytics (training/validation metrics, confusion matrix)
4. Launch the Application
python flask_app.pyNavigate to http://127.0.0.1:5000 in your browser to start recognizing digits!
Build the Docker Image:
docker build -t -neural_digit_Recognizer .Run the Container:
docker run -p 5000:5000 neural-digit-recognizerAccess the application at http://localhost:5000
Neural_Digit_Recognizer/
│
├── 🌐 flask_app.py # Web server and API endpoints
├── 🎓 train_model.py # Neural network training pipeline
├── 🏗️ model.py # CNN architecture definition
├── ⚙️ config.py # Configuration management
├── 🧠 mnist_model.pth # Trained model checkpoint
├── 📦 requirements.txt # Python dependencies
├── 📖 README.md # Documentation
├── 🐳 Dockerfile # Container specification
├── 🚫 .dockerignore # Docker build exclusions
│
├── 📊 Analytics Output
│ ├── confusion_matrix.csv # Model performance matrix
│ ├── train_metrics.csv # Training history
│ └── val_metrics.csv # Validation metrics
├── Procfile # tell the deployment platform(render) how to start your web application server
├── images/
| └── preview.gif # output preview
├── 🎨 templates/
│ └── index.html # Main web interface
│
└── 📂 static/
├── css/
│ └── style.css # Styling and animations
└── js/
└── canvas.js # Interactive canvas logic
- Validation Accuracy: ~98%
- Model Architecture: Multi-layer CNN with dropout regularization
- Training Dataset: 60,000 MNIST images
- Inference Speed: Real-time prediction (<100ms)
| Component | Technology |
|---|---|
| Deep Learning | PyTorch |
| Web Framework | Flask |
| Image Processing | PIL, OpenCV |
| Frontend | HTML5 Canvas, Vanilla JS |
| Containerization | Docker |
- Multi-language digit recognition
- REST API with authentication
- Model versioning and A/B testing
- Enhanced visualization dashboard
- Mobile app deployment
Contributions are welcome! Feel free to open issues or submit pull requests to enhance the project.
This project is open source and available for educational and commercial use.
Built with ❤️ using PyTorch and Flask
