A multi-phase engineering progression — from raw C++ linear algebra all the way to gesture-controlled real-time digit classification and, eventually, an inference engine running on a microcontroller. Built with zero external dependencies in both the math library and the neural network engine.
The Progression
Matrix<T> class template that powers all neural network math downstream. Written with zero external dependencies.Custom C++ linear algebra library — provides Matrix<T>, optimised GEMM, and the full math backbone for NNFS-Extreme.
Built by starting with a dot product and working upward to a fully performant neural network classifying MNIST digit images. Inspired by Michael Nielsen's book — re-implemented in C++. After achieving 95% accuracy, an experiment swapped inputs and outputs: the network (1 hidden layer, 30 neurons) then generated recognisable digit images.
- Weights & Biases:
vector<Matrix<float>>per layer - Mini-batches: stacked as columns —
X [784×m],Y [10×m]for GEMM - Concurrency: thread pool across sub-ranges, accumulating ∇W and ∇b under a mutex
- Activation: sigmoid everywhere; cost derivative:
output − actual - Binary format:
num_layers → sizes[] → weights → biases
Network nn({ 784, 30, 10 });
nn.SGD(training_data, 20, 32, 2.0F, test_data);
Classifies digits drawn live in the air. A webcam feed is processed through OpenCV and MediaPipe hand landmark tracking; detected strokes are cropped, processed into MNIST-compatible images, and sent through the NNFS-Extreme engine via pybind11 Python bindings.
| File | Role |
|---|---|
MNIST_CV.py | Entry point — calls pipe() |
looping.py | @loop decorator (webcam lifecycle) + per-frame logic |
hand_tracking.py | MediaPipe landmarks, air-canvas sketch, bounding boxes |
image.py | MNIST-compatible image processing pipeline |
nnfs_extreme.pyd | pybind11 C++ extension — exposes Network and feedforward |
Project Structure
Started: 2026-07-29 · Languages: C++, Python
