A. Taheri
← All posts

Evaluating OCR Engines on Handwritten Persian Documents

An initial assessment of handwritten Persian documents for an OCR pilot, featuring early benchmark results across Gemini, RapidOCR, and Tesseract.

The contact sheet is at labeling/preview.png (11 documents, 5 random crops each, titled with the document name and line count). Nothing was sent anywhere, and I haven't started Step 2.

Document Guesses

The crops are unfiltered random picks, so many are fragments. The letter counts come from the older model-generated labels, not ground truth.

#LinesGuess
16579Handwritten Persian, accounting. Many number and fragment crops. Persian/Latin letters in old labels: 140818/230.
25471Handwritten Persian, faint ink, lots of numbers. 103678/556.
34459Handwritten equations and numbers with Latin symbols (H₃L₃, D=1). A poor fit for Persian text. 44008/5322.
41467Gold. Handwritten math: formulas and symbol blobs, little Persian prose. 12671/5951.
51151Clean handwritten Persian, heading style. The best-looking candidate. 49989/3.
6596Mixed: handwritten Persian, English handwriting, and printed «Month/Date» form labels. 20099/7502.
7580Gold. Handwritten Persian. My 5 samples were all fragments and digits, so I can't say more. 24333/188.
8547Handwritten Persian, small and sparse, many near-empty crops. 17146/9.
9287Gold. Clean handwritten Persian in several ink colours. The best gold document. 15102/1.
10276Mixed: handwritten digits in grey table cells and a printed-looking Persian line. The weakest candidate. 4162/431.
11215Gold. Handwritten Persian words plus printed English labels («Month:», «Year:»). 5804/57.

Pilot Document Count

Gold documents are excluded from the pilot, leaving the non-gold candidates: 1, 2, 3, 5, 6, 8, and 10. That makes exactly 7, so picking 6 documents means taking at least one of the weaker ones (3, 6, or 10). I'd recommend 1, 2, 5, and 8, followed by 6 and 3.

Partial DastKhat Table

This table covers the images Gemini completed and the corresponding images for the other engines. The Gemini cache holds 21 images, not 19: the last resume run finished two more before stopping. Only rapidocr-ar and tesseract-fas have DastKhat caches. The Qwen, Gemma, and Qwen3-VL-8B runs were never started. Scores strip the printed caption «فضای نوشتن» from every engine's output.

EngineImagesCERWERWord accs/image
gemini (2.5-flash)210.08300.273472.7%23.05*
rapidocr-ar (control)210.81990.98561.4%1.67
tesseract-fas (control)210.90680.99280.7%0.15

\*Gemini's timing includes retry waits, so it overstates actual latency.

Why the Gemini Run Paused

It hit HTTP 429 (Too Many Requests) and exhausted its 5 retries (with backoffs of 20–90 s). A single test call a few minutes later returned 200, which suggests a per-minute rate burst rather than an exhausted daily quota. I didn't capture the 429 response body, so I can't confirm that for sure. It also ran into a 503 earlier. The resumed run with 6-second pacing was the process you interrupted, so it never got to run.

Two Other Things

  • Ollama: The server is down (connection refused), so the Gemma draft run for your labeling page cut off at 78 drafts. You have 127 labels. I haven't restarted anything yet.
  • Allowlist: I'll cap the pilot at 100 lines per document. Let me know when the allowlist is ready and I'll kick off Step 2.