CNN From Scratch
A convolutional neural network built from first principles in pure NumPy.
- Python
- NumPy
- Computer Vision
- GitHub available
- Training curves
- From scratch (NumPy)
At a glance
- Problem
- Can I implement a CNN — forward and backward — with no deep-learning framework, to truly understand the maths?
- Built
- Hand-coded conv, pooling and dense layers with manual back-propagation, trained on MNIST.
- Models / methods
- A small CNN classifier on handwritten digits.
- Result
- Trains and classifies digits; learns meaningful first-layer edge filters.
- Strength shown
- First-principles understanding of how CNNs actually work.
- Links
- GitHubCase Study
Visual proof



Charts and diagrams are real outputs and architecture from the project.
01Objective
Build and train a CNN using only NumPy to internalise convolution, pooling and back-propagation.
02Dataset / input
The MNIST handwritten-digit dataset (28×28 greyscale images).
03Model approach
- Conv, max-pool and dense layers implemented from scratch
- Manual forward and backward passes (the gradients derived by hand)
- Trained with mini-batch gradient descent
04Results / metrics
The loss curve shows stable training; sample predictions show correct classifications and the characteristic errors (e.g. 9↔7). The learned first-layer filters resemble edge/stroke detectors — evidence the network learned real features.
05Deployment / reproducibility
A single reproducible notebook.
06Limitations
- Small model and dataset for clarity over accuracy
- No GPU acceleration — NumPy only
07Future improvements
- Add batch-norm and more layers
- Vectorise the conv for speed
08Key takeaway
Shows depth of understanding — I can derive and implement the building blocks frameworks hide, not just call them.