Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rapidocr 5

rapidocr_ng 5.0.0a2 is published on PyPI as rapidocr_ng, separate from the official rapidocr. The import name is still rapidocr: pip install rapidocr_ng, then from rapidocr import RapidOCR. Both projects install the same rapidocr package directory, so do not install them in one environment (run pip uninstall rapidocr first). This line is the native PP-OCRv6 engine on the V5_NG branch. The 3.x line (latest tag v3.9.2) stays on main. This repository has no 4.x release.

from rapidocr import RapidOCR, __version__

engine = RapidOCR(params={
    "Det.model_path": "PP-OCRv6_det_tiny.onnx",
    "Rec.model_path": "PP-OCRv6_rec_tiny.onnx",
    "Rec.rec_keys_path": "ppocrv6_tiny_dict.txt",
    "Global.use_cls": False,
})
result = engine("page.png")
print(__version__)
print(result.txts, result.scores)
print(result.to_json())

If model paths are omitted, RapidOCR() downloads the same files as 3.x: default_models.yaml selects the URL, the file is saved under Global.model_root_dir (the package models/ directory when that is null) using the URL filename, and the SHA256 is checked. download_models() and download_models(config_yaml) follow 3.x and return None. PP-OCRv6 ONNX recognizers also download the dictionary published next to the MNN bundles (ppocrv6_tiny_dict.txt / ppocrv6_dict.txt).

Build from a checkout (CMake and a C++20 compiler required). The repository root is the installable project, so the sdist contains the native sources:

pip install .

pip install ./python also works from a checkout, because that project points CMake at the parent tree. It does not produce a self-contained sdist.

The binding is ctypes over the C ABI (include/ppocr/ppocr.h), so the wheel ships libppocr and does not add a second C++ wrapper.

Vulkan

Wheels are built with -DPPOCR_ENABLE_VULKAN=OFF. They do not contain the compute shaders and do not need libvulkan. A checkout that has the Vulkan-Headers submodule and glslangValidator can build a Vulkan-enabled package with:

CMAKE_ARGS="-DPPOCR_ENABLE_VULKAN=ON -DPPOCR_BUILD_STATIC=OFF" pip install .

The runtime opens libvulkan.so.1 with dlopen. It is not linked into the library. Enable it per engine, in the same style as 3.x use_cuda:

engine = RapidOCR(params={
    "EngineConfig.ppocr_cpp.use_vulkan": True,
    "EngineConfig.ppocr_cpp.device_index": 0,
})

device_index -1 skips CPU Vulkan devices such as lavapipe. Set it to the lavapipe index (0 when it is the only device) together with VK_ICD_FILENAMES pointing at lvp_icd.json. If no compute device exists, the call logs a warning and runs on CPU. backend: vulkan is the same attempt. backend: hybrid matches the C++ hybrid path. See docs/API.md.

Migrating from rapidocr 3.x

RapidOCR(config_path=..., params={"Section.key": value}) and engine(img, use_det=..., use_cls=..., use_rec=..., text_score=..., box_thresh=..., unclip_ratio=...) keep the same names. result.txts, result.scores, result.boxes, result.elapse, to_json(), to_markdown(), and vis() are still there. File paths, URLs, bytes, and PIL images are RGB. A numpy array is treated as BGR, then swapped, which is what 3.x does for OpenCV images.

What does not carry over from 3.x:

3.x (main) rapidocr 5
ONNX Runtime, OpenVINO, Paddle, PyTorch, TensorRT, MNN Built-in PP-OCRv6 interpreter. EngineType.ONNXRUNTIME and EngineType.PPOCR_CPP both select it. The other engine names raise NotImplementedError.
PP-OCRv4 and PP-OCRv5 model zoo PP-OCRv6 ONNX detector and recognizer only.
Angle classifier (use_cls=True by default) The cls file is downloaded like 3.x. The native engine does not run it, and logs one warning.
use_det=False or use_rec=False Raises RapidOCRError. Detection and recognition always run together.
Word and character boxes return_word_box / return_single_char_box warn. word_results is empty.
elapse_list is [det, cls, rec] [None, None, total]. The native call is one timed region. An empty page is RapidOCROutput() (boxes/txts/img are None), same as 3.x.
vis() draws with OpenCV in BGR vis() draws with Pillow and returns RGB.
EngineConfig (CUDA, OpenVINO, TensorRT, MNN, …) Those keys load and can be read. They are not applied. EngineConfig.ppocr_cpp.use_vulkan, backend (cpu, hybrid, vulkan), and device_index are applied.
Detector mean/std, limit_type, limit_side_len, use_dilation Passed through the C ABI and applied. mean/std are B, G, R, the same order as an OpenCV image. Recognizer normalization defaults to 0.5/0.5, matching 3.x.
Global.min_height, vertical padding, max_side_len Applied before the native call, and boxes are mapped back.

A call that only reads txts, scores, and boxes from a PP-OCRv6 model can switch by installing this package and leaving use_cls at its default. Set use_cls=False to skip the warning. Do not pass use_det=False or an older OCR version.

Wheels and publishing

.github/workflows/build-wheels.yml builds the manylinux2014 wheels and the sdist. It runs on pushes and pull requests to V5_NG, on tags named v5*, and from the Actions “Run workflow” button. A normal push does not upload anything to PyPI. Publishing happens only when a v5* tag is pushed.

5.0.0a2 is a pre-release: pip install --pre rapidocr_ng or pip install rapidocr_ng==5.0.0a2. pip install rapidocr installs the official 3.x package instead.

How to turn on PyPI Trusted Publishing, which tag to push, and the Actions permission the GitHub Release step needs are in docs/RELEASING.md.

Ported from main (#755)

  • RawMemoryImage(address, length, width, height, pixel_format="BGRA", stride=None, bottom_up=False) reads an uncompressed pixel buffer (GRAY/BGR/RGB/BGRA/BGRX/RGBA/RGBX) by address.
  • bytes, bytearray, MemoryImage and PIL inputs honor the EXIF orientation, like paths.
  • Model routing lives in default_models.yaml under model_routes. RapidOCR.list_supported_langs("rec", "PP-OCRv6", "tiny") and rapidocr --list-langs --task rec --ocr_version PP-OCRv6 --model_type tiny list the languages.
  • Global.model_root_dir accepts str or Path; the recognizer dictionary is stored there too.
  • No OpenCV dependency or extra.

Metadata

Release files for rapidocr-ng 5.0.0a4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rapidocr-ng 5.0.0a4
File Size Uploaded
rapidocr_ng-5.0.0a4.tar.gz 587.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rapidocr-ng 5.0.0a4
File
rapidocr_ng-5.0.0a4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
rapidocr_ng-5.0.0a4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
rapidocr_ng-5.0.0a4-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
rapidocr_ng-5.0.0a4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
rapidocr_ng-5.0.0a4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
rapidocr_ng-5.0.0a4-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
rapidocr_ng-5.0.0a4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
rapidocr_ng-5.0.0a4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
rapidocr_ng-5.0.0a4-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
rapidocr_ng-5.0.0a4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
rapidocr_ng-5.0.0a4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
rapidocr_ng-5.0.0a4-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details
rapidocr_ng-5.0.0a4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
rapidocr_ng-5.0.0a4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ ARM64 Details
rapidocr_ng-5.0.0a4-cp39-cp39-macosx_14_0_arm64.whl CPython 3.9 CPython 3.9 macOS 14.0+ ARM64 Details

Total release size: 47.3 MB

Release files / rapidocr_ng-5.0.0a4.tar.gz

Download URL rapidocr_ng-5.0.0a4.tar.gz
Size 587.9 kB
Tags Source
SHA-256 checksum
How to use checksums
12f1c1036d44e05dc2ef94369c0cc2c39ed52c8dda5ee314b4190df1ae238691
BLAKE2b-256 checksum
How to use checksums
60213647477ef38654b0c0b91634233328dc8ecb57ce2f7afb1e9abcd2da3839
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rapidocr_ng-5.0.0a4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f3ed42395ed98bf565e3f58017c1d41efccb8265a5a85559e047011dcb4bb672
BLAKE2b-256 checksum
How to use checksums
89790c462ea9d3876a86b54ff51f59b22ad65d781846335bb6bba7969f2fffc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rapidocr_ng-5.0.0a4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.8 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
4ede6b22bb43b7821e1e6e3d44d0c9f8cd48d076eca1755ebbcfa6394e9d78c4
BLAKE2b-256 checksum
How to use checksums
daf2d930fbd874c269863fadad7b30293f0408379e3083cd4cd8019fa85fc0dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp313-cp313-macosx_14_0_arm64.whl

Download URL rapidocr_ng-5.0.0a4-cp313-cp313-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
f56e479481160befa62c852c63eb5dcb4fa45f96b04c5514c56641727b670a0e
BLAKE2b-256 checksum
How to use checksums
c6de65181434e4972e3357758bbc46749d8317f6fbab522dbd75ae6f48804294
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rapidocr_ng-5.0.0a4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5af2cda78691c537f81fd975654089daf41c9872200148bc6006652c29e5d2a0
BLAKE2b-256 checksum
How to use checksums
7bcd611a3858af7788b04f4f13ba94a7935c0f944e7c12c6fee78a4f8e8f3ff9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rapidocr_ng-5.0.0a4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.8 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
d37203ed7401e79aca50f695060fd3accf706fdeda5848a61c867567c94d375e
BLAKE2b-256 checksum
How to use checksums
c2a547a843c3b0090b61b36536158c2edbf168609d9f6148b8eb142496a5c25e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp312-cp312-macosx_14_0_arm64.whl

Download URL rapidocr_ng-5.0.0a4-cp312-cp312-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
8d95878b0adba09d0b2fe9b77061f46cae5ea736522563d7fa48bf2f2ba3b833
BLAKE2b-256 checksum
How to use checksums
baeb87584777c81440a0d4be5c83f0f491706b41ffead22eb0cb7371fe88d801
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rapidocr_ng-5.0.0a4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a3ce5aa53cbaf2b3838b1ca813bebb8b9507e5e8269df63fa8a0847c9a0069b9
BLAKE2b-256 checksum
How to use checksums
9472b005511b2f007fc54b2a25669a960d3d17ce4f46faa667971ce49a589cb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rapidocr_ng-5.0.0a4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.8 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
c4fc23aff6573cdfda41a9846c4a635547959d95f170983886a0b068dcce082a
BLAKE2b-256 checksum
How to use checksums
eb93cfa3352765e96cc752b1f861674f678569ec29ed2918d0eaca59d4396ed1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp311-cp311-macosx_14_0_arm64.whl

Download URL rapidocr_ng-5.0.0a4-cp311-cp311-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
f687a0ba4b881695c0564a763b0723c246ef62dcc44eeb42fac8a56c47be43f5
BLAKE2b-256 checksum
How to use checksums
49f5bc944dce277ab06facbee21dca372ad768b90f341322a639af187e9503f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rapidocr_ng-5.0.0a4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
cfc656121ad8de7f5856a7a72e6c584efcf4bb59d32217823746d13e8ec9c001
BLAKE2b-256 checksum
How to use checksums
6d9b5ee42f42b8435d8a89bb000c2053457f14f4851c9b76ee3acc1be8d38c52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rapidocr_ng-5.0.0a4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.8 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
8279af5b7e1e032b33e9b5ef19840123114d197506df76eb8622ca4c229cede3
BLAKE2b-256 checksum
How to use checksums
d998dad3970bef41a89471d838a716a6850c648ac677b32bc2a895dc6a0aff71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp310-cp310-macosx_14_0_arm64.whl

Download URL rapidocr_ng-5.0.0a4-cp310-cp310-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
f792cd86e0ef1713213c87c1fc4e2458207fff6da975d3c156e2eec643bb0745
BLAKE2b-256 checksum
How to use checksums
eafd754f2dadbaf0d1744c99fc8b84eb5c27ab5a12175a117369aa505cda16cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rapidocr_ng-5.0.0a4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8798de414efe8ecee27a20fc90db510ae78e4be51de1210cd845ba406209dfbc
BLAKE2b-256 checksum
How to use checksums
ce383f89192fed4baddaf08e05369f765979928ec11368d2199d9181ebb6ab2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL rapidocr_ng-5.0.0a4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.8 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
e0d51e5b19189ba24be4c781be1abb6092fa03556d79e28a3f969dc81750e324
BLAKE2b-256 checksum
How to use checksums
b4d8fc5ca35c0696172874405926d6ca7a0d4cb49918609d04acc4bdf6832740
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rapidocr_ng-5.0.0a4-cp39-cp39-macosx_14_0_arm64.whl

Download URL rapidocr_ng-5.0.0a4-cp39-cp39-macosx_14_0_arm64.whl
Size 2.4 MB
Tags CPython 3.9 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
8c3e6fbda5bb4100e9adf739ed5d4ea2f3fd1bcc9c59441c58c8f0321df28839
BLAKE2b-256 checksum
How to use checksums
278b688805616f70d3b88bbec3025d34fc1eabd324febca06fdbfb510635efb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page