๐Ÿง  TinyCNN

A tiny neural network that learns to recognise patterns โ€” built entirely from scratch with NumPy, no frameworks. This static page runs the real trained model in JavaScript. View source on GitHub
No TensorFlow No PyTorch Pure NumPy Manual backprop 4 filters GitHub Pages

โœ๏ธ Draw a 5ร—5 pattern

Click squares to turn them blue (on) or leave them dark (off). The network decides: "is this a diagonal pattern or not?"
Not diagonal0.5 ยท unsureDiagonal
0.500 / 1.000

๐Ÿ” What the 4 filters detect

The network has 4 small pattern detectors (filters). Each one slides across your drawing and lights up when it finds something it likes. During training, each filter learned to spot different arrangements of pixels.
Legend: โ–  blue = negative weight (wants pixel OFF), โ–  orange = positive weight (wants pixel ON).

๐Ÿ”ฅ Filter responses

These 4ร—4 grids show how strongly each filter activates on your drawing. Brighter blue = stronger match. This is real data from the actual trained network running in JavaScript.
Draw a pattern to see filter responses

โณ Training: filters learning over time

This shows the 4 filters during the 100 epochs of real training done in Python. Each snapshot was captured during actual gradient descent. Press Play to watch them learn.
Epoch 0 / 99
Drag the slider to jump through training history

๐Ÿ“‰ Loss during training

Loss measures how wrong the network's predictions are. A falling line means it's learning. This chart shows the actual loss from real training โ€” not a simulation.

๐Ÿ“– How it works (for beginners)

1 โ€” Convolution
4 small filters (each 2ร—2) slide across your 5ร—5 drawing. At every position, each filter computes: "how much does this match what I'm looking for?"
2 โ€” ReLU
Negative scores mean "doesn't match." ReLU sets them to zero. Only positive matches survive.
3 โ€” Pooling
Shrinks each 4ร—4 map to 2ร—2 by keeping only the strongest response per block. Now the network cares about whether a pattern exists, not exactly where.
4 โ€” Flatten
The 2ร—2 maps from all 4 filters are unrolled into a single list of 16 numbers โ€” the network's final description of your drawing.
5 โ€” Dense
A single neuron weighs all 16 numbers against what it learned. Produces one number: "how diagonal is this?"
6 โ€” Sigmoid
Squashes the number into 0โ€“1. > 0.5 = "yes, diagonal-like." < 0.5 = "no."
Built from scratch with NumPy ยท Forward pass re-implemented in JavaScript for this static page ยท View on GitHub