Image Feature Extraction
ONNX

Versta Glyphmatte

Glyph Matte U-Net for On-Device Document Processing. A compact (~1.9M-parameter) four-head U-Net trained end-to-end on synthetic text strips that decomposes a 48-px-high text line into ink coverage (matte), stroke weight (weight) and per-pixel foreground/background colour, the signals that drive on-device dewarping and enhancement in the Versta Android app. Designed for edge deployment: ships as ONNX (fp32 + fp16) and converts to a ~1.9 MB int8 MNN model bundled into the Versta OCR pack. Entirely trained using renewable energy.

Model Details

Model Description

Compact Glyph Decomposer, Trained on Clean Synthetic Labels, Ready for MNN int8

This model was created to close the gap between accurate text enhancement and the tight latency and size budgets of offline mobile OCR. Per line strip it predicts an alpha matte (ink coverage, for dewarp/thresholding), a stroke-weight field (for stroke-aware thinning/boldening), and foreground/background colour fields that contain exact ink/paper colours even under degraded capture. Because training supervision is mathematically exact, labels stay clean while only the RGB input is degraded, a fully synthetic pipeline reaches quality that would otherwise demand hand-annotated pixel labels.

  • Developed by: Ricardo Snoek-Valkenburg
  • Model type: Convolutional U-Net (base 16, 4 levels), four named output heads: matte (1ch), weight (1ch), foreground (3ch), background (3ch)
  • Parameters: 1,944,168 (~1.9 MB int8)
  • Input: RGB text line strip, height 48 px; width multiple of 16 (pad before inference, crop after)
  • License: Apache-2.0

Training & Evaluation

Trained from scratch on 50,000 synthetic strips from the Versta Glyphmatte dataset (5 new strips per step × 20k steps) with Adam + OneCycleLR, dice/BCE losses on matte and weight plus colour regression losses. Exported to ONNX with inlined weights (fp32) and an fp16 half-precision variant; validated against the fp32 PyTorch reference across four strip widths (figure-of-merit: max |Δ| ≤ 2.2e-06) and evaluated against a fixed validation shard (per-pixel IoU for the matte, AUC for weight).

Format Files
ONNX fp32 onnx/glyphmatte.onnx, reference runtime graph
ONNX fp16 onnx/glyphmatte_fp16.onnx, GPU/NPU-friendly half precision
Safetensors glyphmatte.safetensors + config.json, training checkpoint + dims
Downloads last month
16
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train Neurora/versta-glyphmatte