Glassbox
A license-plate recognition system: a CNN trained in PyTorch, quantized to int8, and run entirely in the browser through a TypeScript inference engine.












Technical highlights
- Model training: CNN with two convolutional layers (5×5×8, 3×3×16), max pooling, a 64-unit dense layer, and a 37-way softmax (A–Z, 0–9, non-character), trained 16 epochs with AdamW in PyTorch.
- Evaluation: 96.7% validation accuracy and 96.1% on held-out fonts the model never saw, with per-class accuracy and confusion-pair analysis to locate failure modes.
- Synthetic data pipeline: 157,200 character images rendered from 58 fonts and degraded with low resolution, Gaussian and motion blur, sensor noise, embossing, and uneven lighting; a non-character class teaches rejection.
- Browser inference: weights quantized to int8 and exported to JSON; the forward pass is reimplemented in TypeScript, so inference runs client-side with no image upload.
- Computer-vision pipeline: plate localization, homography perspective correction, Otsu and adaptive thresholding, connected-component segmentation with a column-projection fallback, and test-time augmentation over 9 shifted views.
- Interpretability tooling: live activations and feature maps, top-activating inputs per neuron, neuron ablation and amplification, and adjustable dropout.
Architecture
- Training, evaluation, and benchmarking scripts in Python (PyTorch, NumPy, SciPy, Pillow), including an evaluation harness that runs the browser pipeline on real plate photos.
- Post-processing validates reads against plate-format patterns (for example ABC-1234) to correct look-alikes such as 0 and O.
- React and HTML Canvas front end deployed on Cloudflare Workers.
Features
- Sample plates and a plate generator
- Photo upload and camera capture
- Draggable corner correction
- Manual threshold, polarity, and dilation controls
- Per-character confidence and runner-up class
- Hand-drawn input for testing the model