Model · Oct 2026 · runs in your browser
CNN on CIFAR-10
The MNIST network sees white strokes on black. Here the inputs are 32×32 colour photos of planes, cars, birds, cats and six other classes, at every angle and on any background. The same recipe of small convolutions, wider and deeper, and a heatmap of the part of the photo that decided the answer.
- Test accuracy
- 89.69%
- Parameters
- 288,746
- Model file
- 1130 KB, ONNX
- Training time
- 2.2 min, GPU
Try it
CIFAR-10 test images
Loading the model…
Runs in your browser. Nothing is uploaded.
The test images were never seen in training. Uploaded photos are centre-cropped and shrunk to 32×32 first, so pick one where the object fills the frame; CIFAR-10 has no people, so a selfie gets one of the ten classes anyway.
Training run
Results
| Metric | Value | Source |
|---|---|---|
| Test accuracy, 10,000 images | 89.69% | training/cnn_cifar10/log.csv, epoch 40 |
| Test loss | 0.3119 | training/cnn_cifar10/log.csv, epoch 40 |
| Train accuracy (augmented) | 95.08% | training/cnn_cifar10/log.csv, epoch 40 |
| Test accuracy of the exported ONNX file | 89.72% | public/models/cnn-cifar10/meta.json |
| Small CNN on MNIST, for scale | 99.41% | training/cnn_mnist/log.csv |
How it works
Architecture. Three stages of two 3×3 convolutions with batch norm and ReLU, at 32, 64 and 128 channels, with a max pool between stages, so the maps go 32, 16, 8. A global average pool and one linear layer make the classifier.
Where it looked. Because the head is an average followed by a linear layer, the score for a class is the average over positions of a weighted sum of the last 128 maps. Drawing that weighted sum before averaging gives the class activation map (Zhou et al., 2016): an 8×8 grid that says how much each part of the image added to the score. It is computed inside the exported graph, with no gradients needed in the browser.
Training. SGD with Nesterov momentum, batch 128, weight decay 0.0005, a one-cycle learning rate peaking at 0.1 over 40 epochs, bf16 autocast. Augmentation is a random 32×32 crop from the image padded by 4 pixels, and a horizontal flip, done on the GPU.
Reproduce
- Hardware
- NVIDIA GeForce RTX 3050 Laptop GPU, PyTorch 2.6.0+cu124
- Commit
- 83e9c8d
- Data
- CIFAR-10, 50,000 train / 10,000 test, binary release, MD5-checked by the script
Environment
pip install torch numpy onnx onnxruntimeTrain, export and score the ONNX file
python training/cnn_cifar10/train.py