SAVRN
Search Contact SAVRN

Open-weight model

khattat-hybrid-ocr

by Saeid Seyfi saeidseyfi/khattat-hybrid-ocr

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.

Parameters
Context
Weights811.3 KB
Licensecc-by-4.0
AccessOpen weights
Monthly Downloads

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

  1. OpenCV preprocessing — upscale, Otsu/adaptive binarization, deskew, morphology
  2. EasyOCR (fa+ar+en) — CRAFT detection + CRNN recognition
  3. Tesseract 5 (tessdata_best: 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 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 + metrics
  • docs/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.

Configuration7 files · 87.7 KB
Documentation2 files · 4.2 KB
Other1 file · 717.8 KB
Repository1 file · 1.6 KB
Every file
FileTypeSizeSHA-256
demo/hybrid_results.jsonConfiguration63.4 KB
hybrid_ocr/__init__.pyConfiguration754 B
hybrid_ocr/engines.pyConfiguration4.9 KB
hybrid_ocr/formula.pyConfiguration2.4 KB
hybrid_ocr/pipeline.pyConfiguration6.5 KB
hybrid_ocr/preprocess.pyConfiguration3.8 KB
hybrid_ocr/shapes.pyConfiguration6.0 KB
README.mdDocumentation1.8 KB
docs/HYBRID_OCR.mdDocumentation2.4 KB
demo/khattat_hybrid_demo.mp4Other717.8 KB b953d8b9dab8
.gitattributesRepository1.6 KB

License and Download

License
cc-by-4.0
Access
Open weights, no gate
Download from Saeid Seyfi

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.