paddleocr-hebrew 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work, excluding
103
+ those notices that do not pertain to any part of the Derivative
104
+ Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 paddleocr-hebrew contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,18 @@
1
+ paddleocr-hebrew
2
+ Copyright 2026 paddleocr-hebrew contributors
3
+
4
+ This product includes model weights that were fine-tuned from pre-trained
5
+ models released by the PaddleOCR project (https://github.com/PaddlePaddle/PaddleOCR),
6
+ which are licensed under the Apache License, Version 2.0.
7
+
8
+ Base models the recognizers/detectors were derived from:
9
+ - PP-OCRv5 mobile/server detection (DBNet, PPLCNetV3)
10
+ - PP-OCRv5 server/mobile recognition (PPHGNetV2-B4, PPLCNetV3)
11
+ - PP-OCRv6 medium recognition (PPLCNetV4)
12
+ - SVTRv2 recognition (SVTR_HGNet, CTC + NRTR MultiHead)
13
+
14
+ The Hebrew fine-tunes, the 120-character Hebrew charset, the inference/packaging
15
+ code in this repository, and the split-ONNX NRTR host-loop deployment are
16
+ original work of the paddleocr-hebrew contributors, released under Apache-2.0.
17
+
18
+ PaddleOCR is Copyright (c) PaddlePaddle Authors, Apache License 2.0.
@@ -0,0 +1,356 @@
1
+ Metadata-Version: 2.4
2
+ Name: paddleocr-hebrew
3
+ Version: 0.1.0
4
+ Summary: Hebrew OCR — PaddleOCR/SVTRv2 recognizers + a runnable page pipeline (word-DET + script-gated CTC->NRTR cascade)
5
+ Author: Rivok Labs
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/RivoksLab/paddleocr-hebrew
8
+ Project-URL: Models, https://huggingface.co/Rivok/paddleocr-hebrew
9
+ Project-URL: Issues, https://github.com/RivoksLab/paddleocr-hebrew/issues
10
+ Keywords: ocr,hebrew,paddleocr,svtrv2,rtl,onnx,bidi
11
+ Classifier: Natural Language :: Hebrew
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ License-File: NOTICE
19
+ Requires-Dist: numpy>=1.24
20
+ Requires-Dist: opencv-python>=4.8
21
+ Requires-Dist: onnxruntime>=1.17
22
+ Requires-Dist: pyclipper>=1.3
23
+ Requires-Dist: Pillow>=10.0
24
+ Requires-Dist: pypdfium2>=4.25
25
+ Provides-Extra: gpu
26
+ Requires-Dist: onnxruntime-gpu>=1.17; extra == "gpu"
27
+ Dynamic: license-file
28
+
29
+ # paddleocr-hebrew
30
+
31
+ **Built by [Rivok Labs](https://rivoklabs.com)** — [rivoklabs.com](https://rivoklabs.com) · [ronen@rivoklabs.com](mailto:ronen@rivoklabs.com)
32
+
33
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.22163990.svg)](https://doi.org/10.5281/zenodo.22163990)
34
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/LICENSE)
35
+ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/RivoksLab/paddleocr-hebrew/blob/main/examples/colab_quickstart.ipynb)
36
+
37
+ Production-grade **Hebrew OCR** built on PaddleOCR — a family of finetuned
38
+ recognizers (CTC + attention) plus a runnable page pipeline. Strong on the two
39
+ things generic OCR gets wrong for Hebrew: **real-world documents** (menus,
40
+ receipts, invoices, scans) and **bilingual Hebrew+Latin/digit lines**.
41
+
42
+ The flagship recognizer reads long Hebrew lines *single-pass* (71–80 char lines
43
+ at **0.49% CER**) and embedded Latin/number runs inside RTL Hebrew that a plain
44
+ CTC model silently drops.
45
+
46
+ Every model here is a **finetune of a PaddleOCR model** (PaddleOCR v3.7.0,
47
+ Apache-2.0) and is released under the same licence — see [NOTICE](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/NOTICE) and the
48
+ lineage column in [Models](#models) below. All reported CER figures are
49
+ **in-house evaluation on our own test sets**: measured, but vendor-reported and
50
+ not independently verified ([eval/EVAL_RESULTS.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/eval/EVAL_RESULTS.md)).
51
+
52
+ > **Note on scope.** The Paddle training weights (`.pdparams`) and training
53
+ > configs are **not** published — this is a release of inference-ready ONNX
54
+ > models, not a reproducible training pipeline. See
55
+ > [Fine-tuning & collaboration](#fine-tuning--collaboration).
56
+
57
+ ---
58
+
59
+ ## ⚠️ Read this first — Hebrew is RTL, output is LOGICAL order
60
+
61
+ Every label and every model output in this project is **logical Unicode order**
62
+ (the first character you read is the first character in the string). This is
63
+ correct and what you want for storing, searching, scoring, and training.
64
+
65
+ **Only call `python-bidi`'s `get_display()` at the moment you render** to a
66
+ terminal, PDF, or GUI. If you apply `get_display()` before storing or comparing,
67
+ you silently corrupt your text and every downstream CER looks broken. This is the
68
+ #1 way people get garbage out of Hebrew OCR. See [docs/charset.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/charset.md).
69
+
70
+ ```python
71
+ from bidi.algorithm import get_display
72
+ print(get_display(line["text"])) # display ONLY — never before storage/scoring
73
+ ```
74
+
75
+ ## ⚠️ Also read this — these models do not read niqqud
76
+
77
+ The 120-character charset contains **no niqqud (vowel points) and no te'amim
78
+ (cantillation marks)**. The models never emit them. Feed a vocalised page in and
79
+ you get the consonantal text back — the marks are dropped, silently.
80
+
81
+ That is a deliberate scope choice, not a bug, but it rules out some real use
82
+ cases. If you are digitising **liturgical, Biblical, poetic or children's
83
+ material**, or **Yiddish and Ladino** (which use Hebrew script with different
84
+ orthographic conventions), these models will not give you what you need as-is.
85
+
86
+ It also means **you cannot score them against vocalised ground truth** without
87
+ stripping marks from both sides first — otherwise you are measuring a charset
88
+ mismatch, not recognition. To calibrate: on the Hebrew-script split of
89
+ [GlotOCR-bench](https://github.com/cisnlp/GlotOCR-bench), 41 of 100 samples carry
90
+ marks we cannot emit, so a *flawless* recogniser would still score 12.4% CER
91
+ there — 38.9% on the Biblical Hebrew subset alone.
92
+
93
+ Unvocalised Hebrew — which is the overwhelming majority of modern documents,
94
+ signage, receipts, invoices, forms and press — is unaffected.
95
+
96
+ See [docs/charset.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/charset.md) for the full charset and the
97
+ normalisation rules.
98
+
99
+ ## ⚠️ And this — document typography only, not display faces
100
+
101
+ These models are trained on **document type**: receipts, menus, invoices, forms,
102
+ scans, print. They do not generalise to decorative or display faces — striped and
103
+ hatched fills, hollow outlines, heavy poster type.
104
+
105
+ Measured, on the Hebrew-script split of
106
+ [GlotOCR-bench](https://github.com/cisnlp/GlotOCR-bench), which renders every
107
+ sample in a randomly chosen Google Font: the error distribution is bimodal.
108
+ 78 of 100 samples land at a median 5.3% CER; the other 22 fail outright (>50%
109
+ CER), and every one of those is a decorative face. Failure rate is flat across
110
+ languages, so it is font-driven, not script-driven.
111
+
112
+ Two consequences worth planning around:
113
+
114
+ - **Signage, packaging, posters and logos are out of scope.** Use a
115
+ general-purpose OCR or a VLM for those.
116
+ - **Failure is loud, not quiet.** On a face it cannot read, the recogniser emits
117
+ confident garbage — sometimes Latin characters from Hebrew input — rather than
118
+ returning nothing. Check the script of your output if you feed it unknown
119
+ material.
120
+
121
+ ---
122
+
123
+ ## Quickstart (2 minutes)
124
+
125
+ **Nothing to install:** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/RivoksLab/paddleocr-hebrew/blob/main/examples/colab_quickstart.ipynb) runs the whole pipeline on a free
126
+ Colab CPU runtime — read the sample page, then upload your own.
127
+
128
+ From PyPI (Python 3.9 or later; developed and tested on 3.11):
129
+
130
+ ```bash
131
+ pip install paddleocr-hebrew huggingface_hub
132
+ ```
133
+
134
+ ```python
135
+ from huggingface_hub import snapshot_download
136
+ from paddleocr_hebrew import HebrewOCR
137
+
138
+ models = snapshot_download("Rivok/paddleocr-hebrew", # ~190 MB, cached after the first run
139
+ allow_patterns=["config.json", "charset_v2f.txt", "word-det/*", "server-svtrv2/*"])
140
+ ocr = HebrewOCR.word(models)
141
+ for line in ocr.read("page.png")["lines"]: # image or PDF
142
+ print(line["text"]) # logical order (get_display() to show)
143
+ ```
144
+
145
+ From source, with the examples:
146
+
147
+ ```bash
148
+ git clone https://github.com/RivoksLab/paddleocr-hebrew
149
+ cd paddleocr-hebrew
150
+ pip install -e . # installs the `paddleocr_hebrew` package (ONNX inference only)
151
+ pip install huggingface_hub # to auto-download the models from the Hub
152
+
153
+ python examples/quickstart.py examples/sample_images/sample_page.png
154
+ ```
155
+
156
+ ```python
157
+ from paddleocr_hebrew import HebrewOCR
158
+
159
+ ocr = HebrewOCR(models_dir="path/to/downloaded/models") # HF snapshot dir
160
+ result = ocr.read("page.png") # image or PDF
161
+ for line in result["lines"]:
162
+ print(line["text"]) # logical order (get_display() to show)
163
+ ```
164
+
165
+ - **GPU** (CUDA / Jetson): `pip install onnxruntime-gpu` instead of `onnxruntime`.
166
+ - On **Jetson JetPack 6**, run inside a CUDA Docker container — bare-metal
167
+ onnxruntime falls back to CPU. (PaddlePaddle has no aarch64 wheel; everything
168
+ here runs on onnxruntime alone, no Paddle at inference.)
169
+
170
+ Models are hosted on the **Hugging Face Hub**:
171
+ [Rivok/paddleocr-hebrew](https://huggingface.co/Rivok/paddleocr-hebrew)
172
+ (~370 MB, ONNX + per-model cards + md5sums). The small detectors and the mobile
173
+ rec also ship in this repo under [`models/`](https://github.com/RivoksLab/paddleocr-hebrew/tree/main/models/) for a zero-download start.
174
+
175
+ ---
176
+
177
+ ## The pipeline
178
+
179
+ ```
180
+ image / PDF page
181
+ → word detector (mobile DBNet, Hebrew-finetuned) models/word-det
182
+ → word crops
183
+ → SVTRv2 recognizer, script-gated CTC→NRTR cascade server-svtrv2
184
+ · fast single-pass CTC on every crop
185
+ · fall back to the NRTR split-ONNX host loop only on crops with an
186
+ embedded Latin/digit run or low CTC confidence (~10% of crops)
187
+ → reading-order assembly (RTL rows) → Hebrew post-processing
188
+ → {lines, words, meta} (logical Unicode order)
189
+ ```
190
+
191
+ This **word-DET + single-pass** design beats line-level detection on Hebrew
192
+ pages (see benchmark). The recognizer is in
193
+ [`paddleocr_hebrew/plan_e_rec.py`](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/paddleocr_hebrew/plan_e_rec.py); the orchestrator in
194
+ [`paddleocr_hebrew/pipeline.py`](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/paddleocr_hebrew/pipeline.py).
195
+
196
+ ### Two pipelines (same code + recognizer, different detector)
197
+
198
+ ```python
199
+ ocr = HebrewOCR.word(models_dir) # default, flagship
200
+ ocr = HebrewOCR.line(models_dir) # line detector
201
+ ```
202
+
203
+ | pipeline | page-CER | s/page (Jetson) | use it when |
204
+ |---|---:|---:|---|
205
+ | **`word`** (default) | **7.56%** | **4.95** | almost always — faster **and** more accurate |
206
+ | `line` | 10.36% | 6.33 | degraded scans / dense hard layouts where word boxes over-fragment |
207
+
208
+ `line` is **not** faster (fewer rec calls, but each is a wide line crop; the word
209
+ detector's forward pass is also cheaper). Its edge is robustness on hard layouts —
210
+ and, because the recognizer reads a whole line's BiDi in one pass, it keeps
211
+ mixed Hebrew+Latin word order without post-hoc reordering. `quickstart.py`
212
+ takes `--pipeline word|line`.
213
+
214
+ ---
215
+
216
+ ## Models
217
+
218
+ All recognizers share one byte-identical 120-char charset
219
+ ([`models/charset_v2f.txt`](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/models/charset_v2f.txt)). Split-ONNX pairs
220
+ (encoder + decstep) are one logical model — the attention decode loop runs on the
221
+ host (see [docs/techniques.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/techniques.md)).
222
+
223
+ | model | role | arch | finetuned from | format / size |
224
+ |---|---|---|---|---|
225
+ | **server-svtrv2** | **flagship** server REC | SVTRv2 (CTC + NRTR heads) | SVTRv2, Chinese pretrain | `ctc.onnx` 77 MB (INT8 `ctc.int8.onnx` 20 MB) · NRTR split `enc 72 + dec 27 MB` |
226
+ | light-svtrv2small | edge / CPU REC (NRTR-only) | SVTRv2-small (KD student) | distilled from server-svtrv2 | split `enc 28 + dec 27 MB` |
227
+ | server-v5 | alt word-level server REC | PPHGNetV2-B4 (CTC) | PP-OCRv5 server rec | `rec.onnx` 73 MB |
228
+ | server-v6 | alt word-level server REC | PPLCNetV4-medium (CTC) | PP-OCRv6 | `rec.onnx` 60 MB |
229
+ | mobile-word | mobile word REC | PPLCNetV3 (KD student) | PP-OCRv5 mobile rec | `rec.onnx` 7.4 MB |
230
+ | word-det | **word detector** (flagship) | mobile DBNet PPLCNetV3 | PP-OCR mobile DBNet | `det.onnx` 4.6 MB |
231
+ | line-det | line detector (situational) | mobile DBNet PPLCNetV3 | PP-OCR mobile DBNet | `det.onnx` 4.6 MB |
232
+
233
+ Which recognizer? **server-svtrv2** for the best quality on long + bilingual
234
+ lines. **light-svtrv2small** for a small NRTR model on x86-CPU / edge.
235
+ **mobile-word** (7.4 MB) for the smallest word-level footprint. server-v5/v6 are
236
+ CTC word-level alternatives (note: v6 **cannot** do sliding-window long lines —
237
+ SVTRv2 is the long-line tool). Per-model details + numbers in each
238
+ `MODEL_CARD.md`.
239
+
240
+ **Smaller CTC option:** `server-svtrv2/ctc.int8.onnx` (20 MB) is an INT8-quantized copy of
241
+ the CTC head, a quarter of the size with practically the same accuracy (within 0.2 CER points of
242
+ `ctc.onnx` on every slice of 1,861 real line crops; 10.39% vs 10.42% overall). It is a drop-in replacement:
243
+ `HebrewOCR(models_dir, ctc="server-svtrv2/ctc.int8.onnx")`.
244
+
245
+ ---
246
+
247
+ ## Benchmark (headline)
248
+
249
+ Full tables + methodology + caveats in [eval/EVAL_RESULTS.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/eval/EVAL_RESULTS.md).
250
+
251
+ **Clean rendered pure-Hebrew** (public-domain text, perfect GT), micro-CER:
252
+
253
+ | Tesseract | SVTRv2 CTC | cascade | SVTRv2 NRTR |
254
+ |---:|---:|---:|---:|
255
+ | 1.34% | 0.98% | 0.76% | **0.35%** |
256
+
257
+ **Real bilingual heb+lat** (n=233 real crops), micro-CER: Tesseract **16.14%**
258
+ vs our cascade/NRTR **2.33%** (~7× better).
259
+
260
+ **Page-level** (71-page GCV-anchored, SVTRv2 cascade held constant), micro-CER:
261
+
262
+ | word-DET + SVTRv2 | Hebrew line-DET + SVTRv2 | Tesseract |
263
+ |---:|---:|---:|
264
+ | **7.56%** | 10.36% | 14.20% |
265
+
266
+ Tesseract narrowly wins *clean academic* Hebrew but loses badly on real domains
267
+ (thermal 26% vs ~3%, menus 12% vs ~3%). Cross-domain robustness is the edge — see
268
+ [docs/FINDINGS.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/FINDINGS.md).
269
+
270
+ ---
271
+
272
+ ## What's novel here
273
+
274
+ Two techniques we think are worth reusing (writeup in
275
+ [docs/techniques.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/techniques.md)):
276
+
277
+ 1. **Attention decoder on ONNX-only edge via a host-driven split-ONNX loop.**
278
+ A full NRTR decode loop won't export to ONNX (control flow) and Paddle won't
279
+ run on Jetson. Export encoder + one-decode-step as two control-flow-free graphs
280
+ and drive the greedy loop in numpy — reproduces paddle output exactly, runs on
281
+ onnxruntime everywhere.
282
+ 2. **CTC vs attention on bidirectional script.** A monotonic CTC head *deletes*
283
+ Latin/digit runs embedded in RTL Hebrew (heb+lat 12.6% CER); an attention head
284
+ on the same backbone reads them (2.3%). The script-gated cascade gets NRTR
285
+ quality at ~CTC speed.
286
+
287
+ ---
288
+
289
+ ## Documentation
290
+
291
+ - [docs/charset.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/charset.md) — the 120-char charset + the RTL logical-order rule
292
+ - [docs/techniques.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/techniques.md) — split-ONNX host loop, CTC-vs-attention, sliding-window, the cascade
293
+ - [docs/FINDINGS.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/docs/FINDINGS.md) — what we learned (including the negative results)
294
+ - [eval/EVAL_RESULTS.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/eval/EVAL_RESULTS.md) · [eval/run_eval.md](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/eval/run_eval.md) — benchmark + how to reproduce
295
+
296
+ ## Used by
297
+
298
+ - [**HebrewOcrNet**](https://github.com/StasEdward/HebrewOcrNet) by Edward Stas: a C#/.NET
299
+ port of the word pipeline on ONNX Runtime and SkiaSharp, with no Python, on NuGet as
300
+ `HebrewOcrNet`. It reads the Hebrew documents in [Domeniq](https://www.domeniq.app), a
301
+ household paperwork ledger that runs at home.
302
+
303
+ Built something on these models? Open an issue and we'll add it here.
304
+
305
+ ## Fine-tuning & collaboration
306
+
307
+ The models are released as **ONNX** — inference-ready and portable (CPU, CUDA,
308
+ Jetson) from one set of files. ONNX is not a compromise here: on CPU it runs
309
+ ~7× faster than native PaddlePaddle, on Jetson it's the only thing that runs
310
+ (no Paddle aarch64 wheel), and for TensorRT speed on GPU you can point
311
+ onnxruntime's TensorRT execution provider at these same `.onnx` files — no
312
+ extra artifacts needed.
313
+
314
+ The Paddle training weights (`.pdparams`) and training configs are **not
315
+ published** — ONNX is all you need to run the models. If you want to **fine-tune
316
+ on your own Hebrew data, adapt the charset, or collaborate**, please open an
317
+ issue / discussion on this repo or reach out: **ronen@rivoklabs.com**. Happy to
318
+ help and to grow this together.
319
+
320
+ ## About Rivok Labs
321
+
322
+ [**Rivok Labs**](https://rivoklabs.com) builds computational intelligence and automation
323
+ tools, with a particular focus on Hebrew and other right-to-left languages that
324
+ mainstream tooling handles badly.
325
+
326
+ We released this because there was no open-source Hebrew OCR with a commercial-friendly
327
+ licence that held up on real documents. If it is useful to you, or if it fails on your
328
+ documents, we would like to hear about it.
329
+
330
+ - **Web:** [rivoklabs.com](https://rivoklabs.com)
331
+ - **Contact:** [ronen@rivoklabs.com](mailto:ronen@rivoklabs.com)
332
+ - **Issues and discussions:** on this repository
333
+
334
+ ## Citing this work
335
+
336
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.22163990.svg)](https://doi.org/10.5281/zenodo.22163990)
337
+
338
+ ```bibtex
339
+ @software{rivoklabs_paddleocr_hebrew,
340
+ author = {{Rivok Labs}},
341
+ title = {paddleocr-hebrew: production Hebrew OCR with a
342
+ script-gated CTC/attention cascade},
343
+ year = {2026},
344
+ doi = {10.5281/zenodo.22163990},
345
+ url = {https://github.com/RivoksLab/paddleocr-hebrew}
346
+ }
347
+ ```
348
+
349
+ That DOI always resolves to the latest release. To cite this exact version, use
350
+ `10.5281/zenodo.22163991`. GitHub's "Cite this repository" button reads
351
+ [CITATION.cff](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/CITATION.cff).
352
+
353
+ ## License
354
+
355
+ Apache-2.0 (code and model weights). The recognizers are finetuned from
356
+ PaddleOCR models (also Apache-2.0); see [NOTICE](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/NOTICE). See [LICENSE](https://github.com/RivoksLab/paddleocr-hebrew/blob/main/LICENSE).