Repository navigation
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).