OpenOCR, tested on a Mac CPU
1,830
of 1,955 words: OpenOCR's best setup
Fix the reading order first
OpenOCR returns words in a loose order. Sort them into lines.
| Setup | OpenOCR order | Fixed order |
|---|---|---|
| Mobile, 1920 px detector | 1,722 | 1,830 |
| Mobile, PDF input | 1,772 | 1,810 |
| Mobile, defaults | 1,586 | 1,807 |
| Server, defaults | 1,567 | 1,792 |
Its sort swaps two boxes only when their tops are within 10 px, so words on one printed line often come out of order.
The default detector shrinks the page to 960 px on its long side.
Our pages are about 3,000 px tall, so it saw them about
600 px wide. det_input_size=1920 doubled that.
Still behind Tesseract and RapidOCR
| Engine | Words | Time |
|---|---|---|
| RapidOCR, PP-OCRv5 mobile, English model | 1,904 | 8 s |
| Our Actor's code | 1,879 | 3.5 s |
| Tesseract 5.5.4 | 1,878 | 3.1 s |
| OpenOCR mobile, 1920 px, fixed order | 1,830 | 12 s |
| OpenOCR server, fixed order | 1,792 | 42 s |
Same scorer and the same Mac. The first three rows are from our earlier runs today.
It drops spaces between English words
On 16 screenshots, mobile got 98.0% of the letters right but only 38.4% of the words. Many lines came out like this:
yourMajesty,and I trust thatweshall soonhavesomegoodnewsfor
Server mode kept more spaces: 78.5% of words right. On the same shots, RapidOCR's English model got 97.5% and Apple Vision 96.9%.
Book pages lose spaces too, most often at a comma, like
flash,but and that,did. The 1920 px run
had 32 glued pairs, 24 of them at a comma.
Server mode was slower, not better
Server mode swaps in the SVTRv2 recognizer, and it needs torch. It switches to torch by itself, even when you ask for ONNX.
On book pages it found fewer words than mobile and took 4 times as long. On screenshots it peaked at 13 GB of memory.
Its 124 MB weights file stalled for over 20 minutes on ModelScope. The same file from the project's GitHub release took about 2 minutes.
Install openocr-python, not openocr
pip install openocr-python
The PyPI name openocr belongs to a different project.
import json
from openocr import OpenOCR
ocr = OpenOCR(task="ocr", mode="mobile", use_gpu="false")
res, _ = ocr(image_path="page.jpg", save_dir="ocr_out")
boxes = json.loads(res[0].split("\t", 1)[1]) if res else []
# Reading order: rows top to bottom, words left to right
rows = []
for b in sorted(boxes, key=lambda b: sum(p[1] for p in b["points"]) / 4):
ys = [p[1] for p in b["points"]]
y, h = sum(ys) / 4, max(ys) - min(ys)
if rows and abs(y - rows[-1][0]) < h / 2:
rows[-1][1].append(b)
else:
rows.append((y, [b]))
for _, row in rows:
row.sort(key=lambda b: min(p[0] for p in b["points"]))
print(" ".join(b["transcription"] for b in row))
PDF input works, at 144 DPI
Pass a PDF as image_path. OpenOCR draws each page at 144
DPI with PyMuPDF.
Our scan pages came out 922 px wide, under half the JPEG width. It still found 1,810 words in fixed order.
Two small files for mobile
| File | Size |
|---|---|
openocr_det_model.onnx |
12 MB |
openocr_rec_model.onnx |
25 MB |
openocr_det_repvit_ch.pth (server) |
13 MB |
openocr_svtrv2_ch.pth (server) |
124 MB |
The code is Apache-2.0. The model card names no license. PyMuPDF, a required package, is AGPL-3.0 or a paid license.
The recognizer knows Chinese and English letters. Its list has é and ü, but no ö, ñ, ç or ß.
How we ran it
- A Mac with Apple M5 Max, macOS 26.6. openocr-python 0.1.5 with onnxruntime 1.32.0, and torch 2.15.0 for server mode. Two runs at a time, 2 threads each, at low priority.
- The scan: 10 proofread pages from two public domain books on Wikisource, 1920 px JPEGs, 1,955 words. The PDF holds the same 10 JPEGs.
- Score: true words found in order. Screenshots: the 16 at 1x from our screenshot test, words right in any order.
- Times are rough: the Mac ran other work too. The RapidOCR, Tesseract, Actor and Apple Vision numbers are from our earlier runs today.
- The code above printed the same 212 words as the bench run on our first page.
- The 1920 px detector gave the same text as the default on all 16 screenshots.
Scanned pages to text, no install
Run it yourself. Our Apify Actor turns a scanned PDF into Markdown or text. $0.006 a scanned page. Its code found 1,879 of these 1,955 words.
Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free.
Questions people ask
Is OpenOCR better than PaddleOCR?
Not on our English pages. Its best setup found 1,830 of 1,955 words. RapidOCR with the PP-OCRv5 mobile models and the English recognizer found 1,904 on the same pages.
Why does OpenOCR glue words together?
Its recognizer often leaves out the space between English words. On our screenshots, mobile got 98.0% of letters right but only 38.4% of words. Server mode got 78.5% of words.
Can OpenOCR read a PDF?
Yes. Pass the PDF as image_path. It draws each page with PyMuPDF at 144 DPI, or at 72 DPI when 144 DPI would be over 2,000 px.
Which languages does OpenOCR read?
The default models read Chinese and English. For other scripts the team has ScriptMoE, a separate model that the ocr task does not use.
Why does the OpenOCR docs example fail?
Its loop reads line['text'], but each result is a string: the image name, a tab, then JSON. Each box in the JSON has transcription, points and score. OpenOCR also logs every result to standard output.
Does OpenOCR need a GPU?
No. Mobile mode runs on onnxruntime and took about 10 s a page here on 2 CPU threads. Server mode needs torch.