Running a CNN Inside a PDF: MNIST Classifier in 546KB, No Python Needed
cneuralnetwork · x · 2026-11-07
The author trained an MNIST CNN in PyTorch (2 conv layers, 26,698 parameters) and embedded the forward-pass JavaScript into a 546KB PDF, letting Acrobat Reader classify hand-drawn digits entirely inside the document—no Python, browser, API, or network required.
- Input evolution: The first attempt used a 28×28 grid of checkboxes (784 addressable values), which was technically correct but a terrible drawing experience. The fix: reuse Acrobat's built-in freehand Ink annotation, read the stroke coordinates via document JavaScript, and convert them into the 784 pixels the model expects.
- Key insight: The arithmetic was the easy part; getting a human to draw on the page was where the document pushed back.
- The post includes 3 interactive figures, plus a downloadable interactive PDF and source/tests.
Related event: Developer Runs a CNN Inside a PDF File(2 posts)→
More from Fun
- Gamer regrets playing OoT remake instead of vibe coding a personal finance app — feregri_no · 2026-11-07
- AI meme: GPT-6.2 waits for Fable 5.5, Gemini 4 waits for both—nobody launches anything — AccBalanced · 2026-11-07
- Users suspect silent Claude Opus swap: repetition loops and sudden Spanish replies — justalexoki · 2026-11-07
- Fan decompilation port hits GitHub with ultrawide, high FPS support; will GTA 6 be next? — chrisfirst · 2026-11-07
- Clifford Pickover Shares 'Future AI Data Centers' Meme Joking About Partisan Politics — pickover · 2026-11-07
- Vibe coding a 3D room, then commanding a 'biblically accurate angel' — StewartalsopIII · 2026-11-07