A from-scratch hybrid OCR pipeline for the saeidseyfi/khattat dataset, built by saeidseyfi from 100% free, offline components — no training required, no paid APIs. 1. OpenCV preprocessing — upscale, Otsu/adaptive binarization, deskew, morphology 2.
Model Card
By Saeid Seyfi, published under cc-by-4.0, revision b13702f07c44.
A from-scratch hybrid OCR pipeline for the saeidseyfi/khattat dataset, built by saeidseyfi from 100% free, offline components — no training required, no paid APIs. 1. OpenCV preprocessing — upscale, Otsu/adaptive binarization, deskew, morphology 2. EasyOCR (fa+ar+en) — CRAFT detection + CRNN recognition 3. Tesseract 5 (tessdatabest: fas / ara / eng) — LSTM models with word confidences 4. Confidence ensemble — script detection + weighted candidate selection + language normalization 5. pix2tex (LaTeX-OCR) for math formulas — ViT -> LaTeX + math-token candidate scoring 6. OpenCV contour classification for hand-drawn shapes (10 classes) 7. Caption OCR — first ink cluster below the shape -> en…
Read Saeid Seyfi's full model card
khattat-hybrid-ocr — hybrid OCR pipeline (fa / ar / en / math / shapes)
A from-scratch hybrid OCR pipeline for the saeidseyfi/khattat
dataset, built by saeidseyfi from 100% free, offline components — no
training required, no paid APIs.
Pipeline
- OpenCV preprocessing — upscale, Otsu/adaptive binarization, deskew, morphology
- EasyOCR (fa+ar+en) — CRAFT detection + CRNN recognition
- Tesseract 5 (tessdata_best: fas / ara / eng) — LSTM models with word confidences
- Confidence ensemble — script detection + weighted candidate selection + language normalization
- pix2tex (LaTeX-OCR) for math formulas — ViT -> LaTeX + math-token candidate scoring
- OpenCV contour classification for hand-drawn shapes (10 classes)
- Caption OCR — first ink cluster below the shape -> en OCR
Results on khattat test sets (CPU)
| Branch | Metric | Hybrid | Old CRNN |
|---|---|---|---|
| fa lines (20) | pooled CER | 0.320 | 0.681 |
| ar lines (40) | pooled CER | 0.316 | 0.656 |
| en lines (30) | pooled CER | 0.169 | 0.41 |
| formulas (29) | mean CER | 0.307 | ~1.0 (OOV) |
| shapes (15) | accuracy | 80% | 0.13 |
| captions (12) | mean CER | 0.381 | 1.0 |
Files
demo/khattat_hybrid_demo.mp4— 83s demo video (Shabnam / Amiri / DejaVu rendering)demo/hybrid_results.json— full per-sample predictions + metricsdocs/HYBRID_OCR.md— architecture + usage docs
Code: https://github.com/ramazanzadehnazaninzahra-del/handwritten-ocr-dataset-pipeline Dataset: https://huggingface.co/datasets/saeidseyfi/khattat
Identity and Version
- Repository
- saeidseyfi/khattat-hybrid-ocr
- Publisher
- Saeid Seyfi
- Task
- Not stated by the source
- Modality
- Other
- Library
- Not stated by the source
- Parameters
- Not stated by the source
- Languages
- fa, ar, en
- Revision
- b13702f07c44a3a3a074514672b8e4bc9fabc7e8
- First published
- 2026-09-18
- Last updated
- 2026-09-18
Files and Weights
11 files, 811.3 KB in total.
Every file
| File | Type | Size | SHA-256 |
|---|---|---|---|
| demo/hybrid_results.json | Configuration | 63.4 KB | — |
| hybrid_ocr/__init__.py | Configuration | 754 B | — |
| hybrid_ocr/engines.py | Configuration | 4.9 KB | — |
| hybrid_ocr/formula.py | Configuration | 2.4 KB | — |
| hybrid_ocr/pipeline.py | Configuration | 6.5 KB | — |
| hybrid_ocr/preprocess.py | Configuration | 3.8 KB | — |
| hybrid_ocr/shapes.py | Configuration | 6.0 KB | — |
| README.md | Documentation | 1.8 KB | — |
| docs/HYBRID_OCR.md | Documentation | 2.4 KB | — |
| demo/khattat_hybrid_demo.mp4 | Other | 717.8 KB | b953d8b9dab8 |
| .gitattributes | Repository | 1.6 KB | — |
License and Download
- License
- cc-by-4.0
- Access
- Open weights, no gate
Released by Saeid Seyfi through its official repository on Hugging Face. Read the license.
Questions About khattat-hybrid-ocr
Can I use khattat-hybrid-ocr commercially?
Yes. khattat-hybrid-ocr is released under Creative Commons Attribution 4.0. CC BY 4.0 permits sharing and adapting the work, including commercially, provided the creator is credited and changes are indicated.