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.0a1 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.0a1 is a pre-release: pip install --pre rapidocr_ng or pip install rapidocr_ng==5.0.0a1. 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.0a1

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.0a1
File Size Uploaded
rapidocr_ng-5.0.0a1.tar.gz 554.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for rapidocr-ng 5.0.0a1
File
rapidocr_ng-5.0.0a1-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.0a1-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.0a1-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.0a1-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.0a1-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.0a1-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.0a1-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.0a1-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.0a1-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.0a1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ ARM64 Details

Total release size: 34.5 MB

Release files / rapidocr_ng-5.0.0a1.tar.gz

Download URL rapidocr_ng-5.0.0a1.tar.gz
Size 554.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4d13cb3cd80c24a2a90c805a04ff5743248b673adac8e579c4d1113bca496286
BLAKE2b-256 checksum
How to use checksums
4b8ed8c37939726ba4a660e273a514ae6f8463858c78a5d92e71b77feaa9afe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL rapidocr_ng-5.0.0a1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e95efd235ef9e7bd463d09eb4d237f6a052289d4f22cb57d8690d5a3fd050dad
BLAKE2b-256 checksum
How to use checksums
3db0372d04157eb2558efb5354567cab34e5115d97d6ef3aad9b139edf4500f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

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

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

Download URL rapidocr_ng-5.0.0a1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f8221d392fd76778a01148cdb9fbfdf6434e4edfc04a5f4a868f4f620c2a575f
BLAKE2b-256 checksum
How to use checksums
ba872c940d9f9e244703aa978029ea083caad476deab4f294a07dadaddd5a57a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL rapidocr_ng-5.0.0a1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.7 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
1da91bc3accfa48582a16f126fe6ad1d8201291f8f5ae91185156bbf1e52baf7
BLAKE2b-256 checksum
How to use checksums
62ac1c178935e77ef9020f3ae7c597af26f698dde26048948ca4b01d8f9fe2f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL rapidocr_ng-5.0.0a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1f31834864f7111cb730acb884b40ccd0be7be6763be1fbf76775971106a3ef8
BLAKE2b-256 checksum
How to use checksums
4ba45c60485cc5b7f38a8c51e9c1858c5dfbd03e05676b9cc9da82f3c796e999
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL rapidocr_ng-5.0.0a1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.7 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
3e33254c088427babc294b204143c3948a085147c29f8b6e78a14375da2b93cd
BLAKE2b-256 checksum
How to use checksums
9388c002f0d3b0057729e676bcb5dfd5e57ebe783ffae1c2d261b2794bc02973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL rapidocr_ng-5.0.0a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0a348ee37a0136218003576d92ae09dab19c085a86c11ab3f2b386f016c3270c
BLAKE2b-256 checksum
How to use checksums
7c7ee5a103443435d82b1d304d732daf5ab64a287620663c005ff28b15f15b0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

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

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

Download URL rapidocr_ng-5.0.0a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 4.1 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
92224b12cdccbc808df06a9f5b79d58270335870accaeb6055a83057d0af2562
BLAKE2b-256 checksum
How to use checksums
28559919004a0dbfec2f4edcb8303efb9cd90039d951ff0a429b783f6c0525cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL rapidocr_ng-5.0.0a1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.7 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
61ee0a60ab6a7409a6d6719c54fc0ac170356a93b90e8aa57c3984dd40f5750f
BLAKE2b-256 checksum
How to use checksums
1aad28626a6f54edeed7c720353861e8ad2c485a8d9853e684ff5d061ee99230
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5
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