Downloads · 30 days
0
medyas/arabic_PP-OCRv5_mobile_rec
arabic_PP-OCRv5_mobile_rec is a image-to-text model from medyas. Use it when you need a caption or text from an image. It is set up for PaddleOCR. The card lists the license as apache-2.0.
Arabic printed-text recognition model — a fine-tune of PaddleOCR's arabicPP-OCRv5mobilerec (PP-OCRv5 recognition, PPLCNetV3 backbone, MultiHead CTC + NRTR). This is the baseline arm of an a→b study that fine-tunes Ara…
Downloads · 30 days
0
Access
Public
Updated Jun 23, 2026
Repo size
43.9 MB
Likes
0
Public
Click a slice to open those files.
.pdparams35.9 MB · 81%
From the Hugging Face model README
Arabic printed-text recognition model — a fine-tune of PaddleOCR's
arabic_PP-OCRv5_mobile_rec (PP-OCRv5 recognition, PPLCNetV3 backbone,
MultiHead CTC + NRTR). This is the baseline arm of an a→b study that
fine-tunes Arabic PP-OCRv5 first (this model) and then PP-OCRv6 on an
upgraded corpus, to measure the gain. The headline/shipped model is
medyas/arabic_PP-OCRv6_small_rec;
this v5 model is the honestly-labelled, reproducible baseline.
Backbone=PPLCNetV3 (scale 0.95), Head=MultiHead (CTCHead svtr neck + NRTRHead)arabic_PP-OCRv5_mobile_rec_pretrained (PaddleOCR official Arabic PP-OCRv5 — already has an Arabic prior)medyas/arabic-ocr-printed-500k — 500k synthetic Arabic printed lines (15 fonts)Peak epoch-4 checkpoint on real KITAB-Bench subsets. CER = character error
rate, WER = word error rate (lower is better). patsocr is the selection set
(real scanned printed text) used to pick the peak epoch; isippt and
historyar are held-out. All numbers re-scored 2026-06-23 under the
current consolidated harness (eval/contract.py + eval/normalize.py,
PaddleOCR v3.7.0) so they are directly comparable to the v6 model card.
| Subset | Type | n | CER (strict) | CER (loose) | CER (no-mirror) | WER (strict) |
|---|---|---|---|---|---|---|
| patsocr | real scanned printed (selection) | 500 | 11.8% | 11.4% | 11.8%¹ | 40.1% |
| isippt | presentation / document (held-out) | 500 | 17.0% | 16.2% | **14.7%**² | 63.1% |
| historyar | historical scanned printed (held-out) | 200 | 51.8% | 51.2% | 51.5% | 98.3% |
¹ patsocr has no decode-mirror lines (near-pure Arabic), so strict = no-mirror. ² isippt no-mirror (14.7%) is over the n=341 crops with no decode-mirror ambiguity; strict (17.0%) is over the full n=500 and is the leaderboard-comparable number. "Decode-mirror" lines contain western digits / bracket pairs where the visual↔logical reordering is a known decode-time bookkeeping artifact.
Representative accuracy for modern printed Arabic is patsocr ≈ 11.8%
(scanned) and isippt ≈ 14.7–17.0% (documents/presentations). historyar
51.8% is a domain gap — historical scans (degraded paper, old typography, heavy
diacritization) the v1 corpus does not model; shown as a hard out-of-domain
reference, not representative of modern print. (An earlier version of this card
reported adab instead; that set was recharacterized as handwriting —
off-domain for a printed CTC recognizer — and dropped from the printed eval.)
These are the OCR subsets of KITAB-Bench (Heakl et al., 2025, arXiv:2502.14949, Table 9), so competing systems' scores on the same images are published. CER (lower = better):
| Model | patsocr | isippt |
|---|---|---|
| Gemini-2.0-Flash | 0.01 | 0.06 |
| GPT-4o | 0.23 | 0.08 |
| arabic_PP-OCRv6_small_rec (sibling, headline) | 0.10 | 0.11–0.135 |
| arabic_PP-OCRv5_mobile_rec (this model) | 0.118 | 0.147–0.170 |
| GPT-4o-mini | 0.53 | 0.15 |
| Tesseract | 0.14 | 0.31 |
| AIN-7B (Arabic VLM) | 0.26 | 0.36 |
| PaddleOCR (off-the-shelf) | 0.77 | 0.81 |
| Qwen2.5-VL | 0.98 | 1.27 |
Even this baseline arm is competitive — it beats Tesseract, off-the-shelf PaddleOCR, AIN, and the general Qwen-VLs, and trails only frontier/specialist systems. The v6 sibling improves on it across the board (see below). KITAB's official scorer normalizes more aggressively (alef/teh-marbuta folding) than this harness, so these are conservative upper bounds.
| Set | v5 (this model) | v6 (headline) | Δ |
|---|---|---|---|
| patsocr CER | 11.8% | 10.2% | −1.6 |
| isippt CER (strict) | 17.0% | 13.5% | −3.4 |
| isippt CER (no-mirror) | 14.7% | 10.9% | −3.8 |
| historyar CER | 51.8% | 50.3% | −1.5 |
v6 wins on every set. Note the gain is backbone (PPLCNetV3→V4) + corpus upgrade combined — v6 trained on an 800k corpus (display fonts + textured backgrounds), this v5 arm on 500k — not an isolated backbone ablation.
Epoch 4 was the lowest-CER checkpoint on the real scanned selection set:
| epoch | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| CER | 28.9% | 15.9% | 18.3% | 11.8% | 13.8% | 12.8% | 12.8% | 13.1% |
amp_level=O2, fp16save_epoch_step=1; peak = epoch 4 selected by lowest CER on the real held-out scanned set (patsocr), not on synthetic valconfigs/rec/PP-OCRv5/PP-OCRv5_mobile_rec.yml (included as PP-OCRv5_mobile_rec.yml). Warm-started from the Arabic pretrained weights, character_dict_path=ppocrv5_arabic_dict.txt, AMP O2, batch 194/card.Training labels are stored in VISUAL order (via bidi.get_display). The
character dict filename contains the substring arabic
(ppocrv5_arabic_dict.txt), which triggers PaddleOCR's CTC-decode
pred_reverse path — so tools/infer_rec.py emits predictions in logical
(reading) order. Keep the dict filename containing arabic or decoding order
will be wrong.
Do not pip install paddleocr (it pulls torch and breaks the Paddle ABI).
Install PaddlePaddle directly and run from a PaddleOCR clone:
git clone https://github.com/PaddlePaddle/PaddleOCR
cd PaddleOCR
pip install paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
# (CPU: pip install paddlepaddle==3.2.0 ; then pass Global.use_gpu=false below)
hf download medyas/arabic_PP-OCRv5_mobile_rec --local-dir <dl>
python tools/infer_rec.py \
-c PP-OCRv5_mobile_rec.yml \
-o Global.pretrained_model=<dl>/arabic_PP-OCRv5_mobile_rec \
Global.character_dict_path=<dl>/ppocrv5_arabic_dict.txt \
Global.infer_img=<your_image.png>
(Global.pretrained_model takes the path without the .pdparams suffix.
Feed line crops — this is a recognition-only model; pair with a detector for
full-page OCR.)
inference/)The repo also ships a PaddleInference export of the peak (epoch-4) checkpoint
under inference/ (inference.json + inference.pdiparams + inference.yml)
for serving via PaddleInference / the PaddleOCR predict() API — no PaddleOCR
clone or training config needed at runtime.
⚠️ Decode order — important. This model was trained on visual-order
labels, so its raw CTC output is in visual (RTL-display) order.
tools/infer_rec.py (above) reverses it to logical reading-order automatically
because the dict filename contains arabic. The exported inference.yml
carries an inline dict (no path), so the bare CTCLabelDecode postprocess
does not reverse. To recover logical reading-order from the inference model,
apply pred_reverse to its output:
import re
def pred_reverse(pred): # from PaddleOCR rec_postprocess, for "arabic"-class dicts
out, cur = [], ""
for c in pred:
if not re.search(r"[a-zA-Z0-9 :*./%+-]", c):
if cur: out.append(cur)
out.append(c); cur = ""
else:
cur += c
if cur: out.append(cur)
return "".join(out[::-1])
# logical_text = pred_reverse(model_visual_output)
For guaranteed logical output with zero post-processing, use
tools/infer_rec.py with the .pdparams checkpoint (above).
Synthetic Arabic printed lines rendered via libraqm / RAQM (15 fonts: Naskh / Kufi / Ruqaa / sans families). Text from Wikipedia vocabulary plus general numerics and dates. Normalization: NFKC, tashkeel stripped (v1), western digits. Real-scan augmentation: blur, noise, salt-and-pepper, JPEG recompression, rotation. (The v6 sibling extends this corpus to 800k with display fonts + textured backgrounds.)
Apache-2.0 (inherited from PaddleOCR). The training corpus is synthetic.
arabic_PP-OCRv5_mobile_rec.pdparams — peak weights (epoch 4)arabic_PP-OCRv5_mobile_rec.states — training metadata (best metric / epoch)ppocrv5_arabic_dict.txt — character dictionary (filename must contain arabic)summary_arabic_PP-OCRv5_mobile_rec.json — full eval summaryPP-OCRv5_mobile_rec.yml — base training config (for reproducibility)inference/ — deployable PaddleInference export (inference.json / .pdiparams / .yml; see Deployable inference model)