https://github.com/sidsurakanti/mnist-classification
realtime handwritten digit recognition & mnist digit classification from scratch w/ only maths and numpy
https://github.com/sidsurakanti/mnist-classification
classification math ml mnist numpy
Last synced: about 1 month ago
JSON representation
realtime handwritten digit recognition & mnist digit classification from scratch w/ only maths and numpy
- Host: GitHub
- URL: https://github.com/sidsurakanti/mnist-classification
- Owner: sidsurakanti
- Created: 2025-04-12T03:29:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-02T05:24:40.000Z (11 months ago)
- Last Synced: 2025-08-02T08:18:21.781Z (11 months ago)
- Topics: classification, math, ml, mnist, numpy
- Language: Jupyter Notebook
- Homepage:
- Size: 15.2 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Overview
MNIST digit classifier built with just NumPy and Math. It also has a Pytorch + a realtime web implementation using FastAPI and Next.js.

## What I learned
- How to implement a neural net from scratch
- Forward and backward propagation using pure math
- Vectorized operations with NumPy
- Loss functions, softmax, and gradient descent
- Data normalization, preprocessing, and augumentation
- Visualizing model performance (loss, accuracy, confusion matrix)
- Optimizing data pipeline
- Pytorch
- Full-stack integration with FastAPI and Next.js
## Stack








## Getting started
Play around with the project w/ demo.py or view the demo web app locally.
### Prerequisites
- Python 3.10+
- pip
- Node.js 18+
- npm
- PyTorch with CUDA
- Git w/ LFS (if you want to run barebones NN)
```bash
# check versions
python --version
node -v
pip --version
```
### Installation
0. Setup
```bash
python3 -m venv venv
# sudo apt install git-lfs (if you dont have it)
git lfs install
```
1. Clone the repo
```bash
git clone https://github.com/sidsurakanti/mnist-classification.git
cd /path/to/project/
git lfs pull # pull tracked mnist files for nn or download mnist and replace /dataset/
```
2. Setup the model
```bash
# backend setup
pip install -r requirements.txt
fastapi dev predict.py
```
3. Start up the website
```bash
# frontend setup
cd frontend
npm install
npm run dev
```
The app should now be live on http://localhost:3000!
## Roadmap
- [x] Build a neural net with only NumPy
- [x] Implement backpropagation
- [X] Add softmax + cross-entropy
- [x] Visualize accuracy/loss
- [X] Rebuild using Pytorch
- [X] Add GUI to draw digits and classify in real-time
- [X] Improve digit preprocessing for the HTML canvas
- [ ] Dockerize model
- [X] Deploy online
## Contributing
Pull requests are welcome! Feel free to open an issue or suggestion. (be fr rn no one is pr'ing this)