Generates model and activations for cnn-visualizer, a static site that visualizes the trained model's activations layer by layer.
cnn_scratch/model.py:SmallCNN, 3 conv blocks plus a dense head, 600k params, with annotationscnn_scratch/layers.py: reference implementation ofConv2d,Linear,ReLU,MaxPool2d,Flattenwritten in terms of slicing,unfold, and matmul. Not used bySmallCNN(which uses stocktorch.nnlayers for training speed), but kept as a readable companion for understanding what those layers computecnn_scratch/data.py: CIFAR-10 loading, normalization, augmentation.train.py: PyTorch training loop.scripts/eval.py: test-set accuracy, per-class accuracy, confusion matrix.scripts/export_activations.py: runs sample images through the trained model and dumps activation PNGs plus a manifest for the viz site.
python -m venv venv
. venv/Scripts/activate
pip install -r requirements.txt
python train.py --out checkpoints/run1 --epochs 30
python scripts/eval.py --ckpt checkpoints/run1/best.pt --out checkpoints/run1
python scripts/export_activations.py \
--ckpt checkpoints/run1/best.pt \
--out ../../explorablecv/apps/cnn-visualizer/public/activationsCIFAR-10 downloads automatically into data/ on first run (~170 MB).