Skip to content
ProjectsWritingAboutCVLinks
Hire me
HomeProjectsWritingAboutCVLinks

Have a useful problem?

Let's make the next
thing worth inspecting.

© 2026 Abdul WahidBuilt around evidence, not hype. Privacy
ABDUL WAHID
Home/Projects/DigitNet

Case study, Machine Learning

DigitNet
Neural network · From scratch

A neural network written entirely by hand in NumPy — no TensorFlow, no scikit-learn — that reads handwritten digits live in the browser. Draw with the mouse, or in the air on your webcam, and watch every layer think. 98.5% on MNIST, plus a 'not a digit' class that rejects scribbles instead of guessing.

Programming for AI (AIC270) semester project, COMSATS Attock — live demo, Nov 2026.Machine Learning
All projects
Visit

Context

The problem

Digit recognition is usually taught as a library call, and a standard classifier answers everything: draw a meaningless scribble and it still names a digit, confidently. Both hide what a neural network actually is — and what it does not know.

My role: Network core, training pipeline and web integration; semester project team with Saeed Shah (demo) and Adan (report and testing).

Implementation

How it works

No libraries, by hand

The forward pass, softmax cross-entropy loss and backpropagation are implemented directly in NumPy — matrix multiplies, He initialisation and mini-batch gradient descent — with nothing between the mathematics and the code.

Taught the way MNIST was made

Every drawing is preprocessed exactly like the dataset: cropped to its bounding box, fitted into a 20×20 box and centred by mass. Training on shifted and rotated copies lifted accuracy on simulated hand-drawn digits from 66% to 98.7%.

Allowed to say no

An eleventh output class is trained on tens of thousands of synthetic non-digit drawings — random strokes, shapes and half-erased digits — so the network can answer "not a digit" instead of forcing a guess, and the demo refuses any answer below 80% confidence.

Implementation highlights

  • Hand-written backpropagation, no ML libraries
  • 98.51% MNIST test accuracy
  • 'Not a digit' rejection class — 95.8% of unseen junk drawings refused
  • Live neuron visualisation and webcam air-writing

Evidence

What can be verified

The points below summarize the public repository and owner-provided CV where noted. Read the source for implementation details and the evaluation setup before drawing further conclusions.

Test accuracy98.51% on MNIST

9,851 of the 10,000 held-out test digits classified correctly; best digit 1 at 99.65%, hardest digit 5 at 97.76%.

Rejection95.8% of junk refused

Held-out non-digit drawings the model never trained on; only 0.12% of real digits are wrongly rejected.

Parameters109,451

784 → 128 → 64 → 11 fully connected network; the same trained weights run in Python and in the browser demo.

Training set189,000 images

165,000 augmented digit images plus 24,000 synthetic non-digit drawings, trained for 12 epochs of mini-batch SGD.

Boundaries

Limitations and next questions

  • Digits only: the network reads 0–9. Letters (EMNIST) are a documented extension, not part of this build.
  • Softmax confidence is not certainty — a small share of unusual scribbles still passes the rejection class and the confidence gate, which is why the demo always shows the full probability bars instead of hiding them.
Evidence-first note: a live demo demonstrates an interface and workflow; it does not by itself validate model quality, security, or real-world impact.

Technical overview

PythonNumPyJavaScriptMediaPipe Hands

Project links

Inspect the original implementation and, where available, the live application.

Repository

Live demo

Last content review: 14 October 2026. Details may change as project repositories evolve.

Continue exploring

Related work.

Machine Learning

WhyRisk

A live explainable healthcare risk platform: a LightGBM diabetes risk model trained on 70,692 health records (BRFSS), with patient‑level SHAP explanations and role‑based access for patients, doctors, and admins.

Applied AI

Plan Banao

An agent system built in one day at MTM Hackathon '26 that reads a pack of scattered messages — emails, WhatsApp texts and notices in English and Roman Urdu — and produces a complete, validated plan for a 4-hour hackathon: venue, schedule, food, judging and budget. The language model only reads; every decision and figure is computed and checked in code.