PaddleOCR on ONNX Runtime, tested
4.3x
faster than Paddle on a Mac CPU
Same 1,899 words, a quarter of the time
Ten scanned book pages, 1,955 words. PP-OCRv5 mobile, English recognizer, a Mac CPU, 2 threads.
| Setup | Words | Time |
|---|---|---|
| PaddleOCR, Paddle engine | 1,899 | 14.7 s |
| PaddleOCR, official ONNX files | 1,899 | 3.4 s |
| PaddleOCR, our paddle2onnx files | 1,899 | 4.3 s |
| RapidOCR, its own ONNX files | 1,904 | 2.9 s |
The three PaddleOCR runs gave the same text, byte for byte. Memory peaked at 3.7 GB on Paddle and 2.9 GB on ONNX.
The PaddleOCR team measured a similar gap, and a small one on Intel:
- Apple M4: 1.10 s an image on ONNX Runtime, 5.82 s on PaddlePaddle (5.3x).
- Intel Xeon 8350C: 0.61 s and 0.80 s (1.3x).
Two packages, no paddlepaddle
pip install paddleocr onnxruntime
from paddleocr import PaddleOCR
ocr = PaddleOCR(
engine="onnxruntime",
engine_config={"intra_op_num_threads": 2},
text_detection_model_name="PP-OCRv5_mobile_det",
text_recognition_model_name="en_PP-OCRv5_mobile_rec",
use_doc_orientation_classify=False,
use_doc_unwarping=False,
use_textline_orientation=False,
)
for res in ocr.predict("page.jpg"):
print("\n".join(res["rec_texts"]))
-
You need paddleocr 3.7.0 or newer. Versions 3.5 and 3.6 reject
onnxruntime. -
On first use it downloads
PP-OCRv5_mobile_det_onnxanden_PP-OCRv5_mobile_rec_onnxfrom PaddlePaddle on Hugging Face. Apache-2.0. -
PaddleOCR still does the resizing and the decoding, from each
model's
inference.yml. No hand-written decoder. - The install is 451 MB. The paddle folder of paddlepaddle alone is 416 MB.
Set threads in engine_config, not cpu_threads
With engine="onnxruntime", PaddleOCR 3.7.0
drops cpu_threads. Both sessions got 0, which lets ONNX
Runtime pick its own count.
engine_config={"intra_op_num_threads": 2}, as
in the code above, gave both sessions 2.
Two errors, and what they mean
-
RuntimeError: Engine 'paddle_static' is unavailable because dependency 'paddlepaddle' is not installed.You left outengine="onnxruntime", so PaddleOCR went looking for Paddle. -
ValueError: Official model source does not provide a 'onnx' package for model 'PP-OCRv4_mobile_det'.There is no official PP-OCRv4 ONNX download, though a comment in the OCR docs pairsocr_version="PP-OCRv4"with the ONNX engine. Use v5 or v6.
Convert a model yourself with paddle2onnx
For a fine-tuned model, or one with no official ONNX copy. This step needs paddlepaddle, and Python 3.12 or older.
First run the PaddleOCR call above once without the two engine lines.
That downloads the Paddle models to
~/.paddlex/official_models.
# Python 3.12 or older: paddle2onnx 2.1.0 has no wheel for 3.13
pip install paddlepaddle paddleocr paddle2onnx
M=~/.paddlex/official_models
for m in PP-OCRv5_mobile_det en_PP-OCRv5_mobile_rec; do
mkdir -p onnx/$m
paddle2onnx --model_dir $M/$m --model_filename inference.json \
--params_filename inference.pdiparams \
--save_file onnx/$m/inference.onnx --opset_version 11
cp $M/$m/inference.yml onnx/$m/
done
Then load your files in PaddleOCR
Add two lines to the PaddleOCR call above:
text_detection_model_dir="onnx/PP-OCRv5_mobile_det",
text_recognition_model_dir="onnx/en_PP-OCRv5_mobile_rec",
- Our files were not the same bytes as the official ones, but gave the same text.
- At run time it tries to pip install onnxruntime and onnx_graphsurgeon. Our venv had no pip, so it printed "Could not automatically install required module" and still wrote both files.
-
The docs also show
paddlex --paddle2onnx. I did not test that route.
CoreML broke the text
The Mac onnxruntime wheel ships the CoreML provider. I turned it on
with providers in engine_config, on the
first 2 pages.
| Provider | Words | Time |
|---|---|---|
| CPU | 360 | 3.6 s |
| CoreML, then CPU | 23 | 14.3 s |
CoreML also peaked at 11 GB of memory. Stay on the CPU. I did not dig into why.
RapidOCR is the other ONNX route
- It found 5 more words, and peaked at 2.0 GB of memory.
- Its install is 230 MB, half of PaddleOCR's.
- It shrinks each page to 2,000 px on the long side first, and has its own API.
- The code is in our RapidOCR guide.
Or skip the install
PDF OCR to Markdown, our Apify Actor, reads a scanned PDF by URL and returns Markdown or text.
- It reads each page with Tesseract. Pages Tesseract reads badly get a second read by RapidOCR, on ONNX Runtime.
- On November 17 its code found 1,879 of these 1,955 words, fewer than PaddleOCR here.
- A scanned page costs $0.006, plus $0.00005 to start each run at the default 1 GB of memory.
- We make the Apify Actor, and none of the tools above.
What I did not test
- NVIDIA GPUs, Windows and Linux.
- PP-OCRv6 models and languages other than English.
- PaddleOCR's high performance mode. It needs paddlepaddle and runs on Linux x86-64 only.
How I tested it
- A Mac with Apple M5 Max, macOS 26.6, and the versions below.
- The scan: 10 proofread pages from two public domain books on Wikisource, 1920 px JPEGs. Score: true words found in order.
- PaddleOCR ran with its three page-fix models off. One run at a time, 2 threads, at low priority.
-
The timed runs also set
inter_op_num_threadsto 1. Python 3.13, or 3.12 for paddlepaddle and paddle2onnx. - Times are rough: the Mac ran other work too. The Paddle run started at the lowest load of any run, our export at the highest.
- Scripts and results stay in our private repo, in research/bench/paddleocr-onnx-2026-11-25/.
| Package | Version |
|---|---|
| paddleocr | 3.7.0 |
| onnxruntime | 1.32.0 |
| paddlepaddle | 3.3.1 |
| paddle2onnx | 2.1.0 |
| rapidocr | 3.10.0 |
Questions people ask
Does PaddleOCR support ONNX?
Yes. Since 3.7.0, pass engine="onnxruntime" and PaddleOCR downloads ONNX copies of the models from PaddlePaddle on Hugging Face. The old 2.x versions had use_onnx, with ONNX files you bring.
Do I need paddlepaddle to run PaddleOCR ONNX models?
Not to run them: paddleocr and onnxruntime are enough. You need paddlepaddle to convert a model yourself with paddle2onnx.
Is the ONNX output the same as Paddle's?
On our 10 pages, yes. The official ONNX files and our own export gave the same text as the Paddle engine, byte for byte.
Can PaddleOCR ONNX use CoreML on a Mac?
Not well in our test. With the CoreML provider, the same models found 23 of 381 words, where the CPU found 360.
Related guides
- PP-OCRv5 mobile vs server, tested on a Mac CPU
- RapidOCR in Python: tested vs Tesseract and PaddleOCR
- PaddleOCR in Python: what predict() returns, tested
- PaddleOCR on a Mac: CPU setup and results, tested
- PaddleOCR in Docker: a tested Dockerfile for arm64 and amd64
- Best open source OCR in 2026: 28 engines on 10 book pages