Repository navigation
Releases
fenet v1.1.0
fenet now reads digits in Firefox as well as Chrome, Edge, Brave and Arc. Try it. The trained model is the same as in v1.0.0 (mlp.npz is byte-identical); the filter graph that runs it changed.
Firefox
The old page relied on a Chromium-only behaviour: with edgeMode="none", Chromium lets an feConvolveMatrix read input outside its own primitive subregion, while Firefox and WebKit don't. Every neuron used a one-pixel subregion, so in those engines each neuron saw only its own pixel.
- Each neuron is now a centred 15 × 15 convolution over the whole image plus an
feOffsetto its pixel: 620 primitives instead of 320, with the same arithmetic. - Firefox renders nothing for a filter of more than 256 primitives, so layer 1 runs in two filters.
- Firefox reads correctly when a CSS pixel is a whole number of screen pixels (device pixel ratio 1, 2, 3 or 4). At fractional ratios it shows a note instead of a reading.
- Safari still gets the recording.
| MNIST test, pooled to 14 × 14 / one-cell strokes / Pendigits | 96.7 % / 95.0 % / 94.8 % (unchanged) |
| emulated filter vs model | same answer for 9,991 of 10,000 (unchanged) |
| Chromium 156 vs model | all 200 test digits at each of 8 zoom levels, GPU and software raster |
| Firefox 157 vs model | all 200 test digits at device pixel ratios 1, 2, 3 and 4 |
A convolutional layer (not on the page)
feConvolveMatrix is a convolution, so fenet/convnet.py adds a weight-shared layer in front of the same dense layers: 4 channels of 5 × 5, a 3 × 3 max at every other pixel, interleaved into one 14 × 14 image. It was trained the same way, checkpointed on validation, and evaluated on test once: 97.1 % MNIST pooled (96.7 % today), 95.5 % one-cell strokes, 95.7 % Pendigits. It compiles to filters, and Chromium and Firefox print its answer for every checked digit, but it's 3–4× slower per reading with Chromium's GPU raster. Weights: conv.npz, conv_alpha.json; logs: train_conv.log, logs_conv.txt.
Also
- The repository is reorganised: library in
fenet/, entry points inscripts/(run aspython -m scripts.<name>from the root),model/andresults/. scripts/probe/subregion.pyreduces the browser difference to one convolution.scripts/probe/upstream/has two tentative web-platform-tests reftests and a draft spec issue (not filed yet).
Files
fenet.html is the page (it links fenet.gif; keep them together). mlp.npz, alpha.json and sample.json are the page's weights, score scale and opening example. logs_evaluate.txt and logs_agreement.txt are the test results on this graph. SHA256SUMS lists checksums.
Reproduce
Python 3.13, pip install -r requirements.txt (exact versions), playwright install chromium firefox, and the data listed in the README (with checksums). On an Apple M4, python -m scripts.train_mlp 40 reproduces mlp.npz byte for byte (sha256 5b4e7feb185ad21fba09b0f1db1560b63e5768bd84f5343beb6975a10ca44362). See the README's Rebuild section for the rest.
MNIST by LeCun, Cortes and Burges. Pendigits by Alpaydin and Alimoglu (CC BY 4.0).
fenet v1.0.0
The first frozen release of fenet: a digit recognizer that runs inside SVG filters, with no JavaScript. Try it in Chrome, Edge, Brave or Arc.
Results (test sets, read once with everything fixed)
| network | 196 → 192 → 96 → 10, 57,322 weights, 8-bit activations, 320 filter primitives |
| MNIST test, pooled to 14 × 14 | 96.7 % |
| MNIST test, one-cell strokes | 95.0 % |
| UCI Pendigits, 14 writers the model never saw | 94.8 % |
| emulated filter vs model | same answer for 9,991 of 10,000; the rest are near-ties |
| Chromium vs model | same answer for all 200 digits at each of 8 zoom levels, GPU and software raster |
The checkpoint, score scale and opening example were chosen on validation data only. The model and page architecture were settled earlier while test accuracy was visible, so the figures may be slightly optimistic; see the README.
What's new for first visitors
- Drawing straight over the opening example works: it disappears on the first press. Before, a 7 drawn there was read as 5.
- Firefox, Safari and engines without
:has()see a notice and this recording instead of a pad that would misread. - Touchscreens are told to tap cells, since dragging doesn't draw.
- A step-by-step diagram of one prediction, built from the filter graph's own intermediate images.
Files
fenet.html is the page (it links fenet.gif; keep them together). mlp.npz, alpha.json and sample.json are the weights, score scale and opening example. logs_evaluate.txt and logs_agreement.txt are the frozen test results, and SHA256SUMS lists checksums for everything.
Reproduce
Python 3.13, pip install -r requirements.txt (exact versions), playwright install chromium, and the data:
| file | sha256 |
|---|---|
data/mnist.pkl.gz (mnielsen/neural-networks-and-deep-learning) |
f11bb9e41d6c1b6c124aa38fd605497bdcfe2ee08cf7c2bb5a41ab5d759e1416 |
data/pendigits/pendigits-orig.tra (UCI dataset 81) |
a66225d68d7d68591e62944df1ad33b3f5aa608e2df2505844b41f5568a80da4 |
data/pendigits/pendigits-orig.tes |
ddb1c19e277a56c7ffe682cc024d6ab73696f9adcc1643ef9ed5aa753007e081 |
Then follow the README's Rebuild section. On an Apple M4, python train_mlp.py 40 mlp.npz reproduces mlp.npz byte for byte (sha256 5b4e7feb185ad21fba09b0f1db1560b63e5768bd84f5343beb6975a10ca44362).
MNIST by LeCun, Cortes and Burges. Pendigits by Alpaydin and Alimoglu (CC BY 4.0).
