cnn/conv.py with the trained weights: the real from-scratch CNN, classifying in your browser.
The target discriminator is a small convolutional net built in pure NumPy: the conv, pool and fully-connected layers, and the backprop that trained it, all hand-written with zero autograd. Draw a patch below and watch the real network classify it, live.
conv2d, and watch the feature map it produces (edges, blur, …).Draw a red square: it scores near zero. Only the red balloon fires the TARGET verdict: the net needs the right colour and the right shape.
Why the negative set mattersThe eight conv-1 feature maps don't all do the same thing: some respond to edges, others to colour blobs. Stacked, they give later layers a richer description to classify.
What a feature map isMax-pooling keeps only the strongest response in each block, so nudging the shape a few pixels barely changes the verdict: the net recognises the target wherever it sits.
How pooling helpsEvery gradient in the backward pass is hand-derived, with no framework. A finite-difference check in the tests confirms the analytic gradients are correct.
The hand-written backprop