r/coolgithubprojects • u/-oghosty • 2d ago
ScanMend: fix rough document scans entirely in your browser (CNN cleanup + searchable PDF export, MIT)
github.comScanMend fixes rough document photos and scans entirely client-side. A small multi-head CNN (TensorFlow.js) reads a 160x160 thumbnail and estimates blur, contrast loss, noise and skew severities. It then applies model-driven unsharp masking and contrast correction, OCRs with Tesseract.js and exports a searchable PDF (corrected image plus invisible text layer). Your document never leaves the browser.
Things I tried to do right:
- Honest evaluation in the README: 600 held-out synthetic images with held-out fonts, plus a 40-document OCR recovery test with ground-truth text. Model-driven correction cut mean OCR word error rate from 0.505 to 0.412 and beat a fixed autocontrast + unsharp baseline (0.549)
- Where it fails, it says so: the noise head is near chance (denoise is manual-only), skew estimation failed validation on real photos (deskew is manual-only), and 20% of corrections make OCR slightly worse, so every correction is slider-controlled and the original is preserved
- No hallucination: corrections are parameterized filters, not learned restoration. Low-confidence OCR words are reported, and exports with under 50% usable words are flagged as possibly inaccurate before saving
Stack: TensorFlow.js, Tesseract.js, jsPDF via CDN. Training pipeline in Python, 4,800 synthetic documents across 96 fonts. MIT license, including the trained model weights.
Repo: https://github.com/mjanthony819/scanmend Live app: https://mjanthony819.github.io/scanmend/app/ Demo: https://youtu.be/ZzA5erHlS6A
Built with AI coding assistance (design iteration, boilerplate, debugging); architecture, training data design and evaluation verified by the author. Feedback and issues welcome.