--- library_name: "fastforks" pipeline_tag: "image-to-text" license: "apache-2.0" tags: - "ocr" - "text-recognition" - "text-detection" - "cuda" - "pytorch" - "fastforks" - "fastforks-card" base_model: - "PaddlePaddle/PP-OCRv5_mobile_det" - "PaddlePaddle/PP-OCRv5_mobile_rec" - "PaddlePaddle/PP-OCRv5_server_det" - "PaddlePaddle/PP-OCRv5_server_rec" --- # PP-OCRv5 (server / mobile) (fastforks) PP-OCRv5 (PaddleOCR 3, Baidu 2025): a DB text detector (PP-HGNetV2 + LKPAN for server, PP-LCNetV3 + RSE-FPN for mobile) finds text lines of any orientation as quads; each line is cut out with a perspective warp and read by a CTC recogniser (PP-HGNetV2 / PP-LCNetV3 with an SVTR neck) over 18 383 characters (simplified and traditional Chinese, English, Japanese, pinyin). Inference as PaddleX's OCR pipeline without the document unwarping and the text-line orientation classifier. The portable `module()` is the detector with its normalisation. This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: . Kernels for the `kernels` backend: . Original code: at `dab3fe353790`. Author weight repos: , , , . Task: ocr. Tier: experimental. Outputs: `boxes`, `texts`, `scores`. Backends: `portable`. Input: one RGB image. Output: the text lines in reading order: a quad `[N, 4, 2]` per line, its text and a confidence `[N]` (text detector + recogniser; recognisers alone read the whole image as one line). ## Variants Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in [`card.toml`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/ocr/models/ppocrv5/card.toml). | variant | weights (author link) | SHA-256 | weights licence | commercial use | |---|---|---|---|---| | `ppocrv5-mobile@1` | [PP-OCRv5_mobile_det/inference.json](https://huggingface.co/PaddlePaddle/PP-OCRv5_mobile_det/resolve/0d63e78e2b680928f6b1747d76a08db6e645efb7/inference.json)
[PP-OCRv5_mobile_det/inference.pdiparams](https://huggingface.co/PaddlePaddle/PP-OCRv5_mobile_det/resolve/0d63e78e2b680928f6b1747d76a08db6e645efb7/inference.pdiparams)
[PP-OCRv5_mobile_rec/inference.json](https://huggingface.co/PaddlePaddle/PP-OCRv5_mobile_rec/resolve/682f20538d8c086cb2128e5cfac775e6c4904e85/inference.json)
[PP-OCRv5_mobile_rec/inference.pdiparams](https://huggingface.co/PaddlePaddle/PP-OCRv5_mobile_rec/resolve/682f20538d8c086cb2128e5cfac775e6c4904e85/inference.pdiparams)
[PP-OCRv5_mobile_rec/config.json](https://huggingface.co/PaddlePaddle/PP-OCRv5_mobile_rec/resolve/682f20538d8c086cb2128e5cfac775e6c4904e85/config.json) | `05feef1acb00`
`afa1820cb16c`
`24587345250c`
`2460da908759`
`6df1587ae056` | Apache-2.0 | yes | | `ppocrv5-server@1` | [PP-OCRv5_server_det/inference.json](https://huggingface.co/PaddlePaddle/PP-OCRv5_server_det/resolve/ca867c897ecbca8873081573a802ad70d499cb94/inference.json)
[PP-OCRv5_server_det/inference.pdiparams](https://huggingface.co/PaddlePaddle/PP-OCRv5_server_det/resolve/ca867c897ecbca8873081573a802ad70d499cb94/inference.pdiparams)
[PP-OCRv5_server_rec/inference.json](https://huggingface.co/PaddlePaddle/PP-OCRv5_server_rec/resolve/b26c3587fda8da3c8ec0ce357214b4d661ff1558/inference.json)
[PP-OCRv5_server_rec/inference.pdiparams](https://huggingface.co/PaddlePaddle/PP-OCRv5_server_rec/resolve/b26c3587fda8da3c8ec0ce357214b4d661ff1558/inference.pdiparams)
[PP-OCRv5_server_rec/config.json](https://huggingface.co/PaddlePaddle/PP-OCRv5_server_rec/resolve/b26c3587fda8da3c8ec0ce357214b4d661ff1558/config.json) | `af5876933d88`
`183146fe9d99`
`8e6e12e5d425`
`63853f062a5f`
`6a780e213d7a` | Apache-2.0 | yes | ## Licence Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: `LICENSE`. Training data: The PP-OCRv5 technical report describes public and synthetic text data plus Baidu's own data; the exact sets are not listed.. Licence evidence: https://github.com/PaddlePaddle/PaddleOCR/blob/dab3fe35379033fdcb2d0e9572fac0b36c9a9ebf/LICENSE ; https://huggingface.co/PaddlePaddle/PP-OCRv5_server_det ## Input size any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `ppocrv5-mobile` 3000x4000 (1.4 GiB peak allocated, 2.3 reserved); `ppocrv5-server` 3000x4000 (7.1 GiB peak allocated, 9.8 reserved) ## Speed and memory ### Ocr, synthetic | model | input | time (ms): original fp32 | original | portable | peak memory (MiB, allocated / reserved): original | portable | | --- | --- | --- | --- | --- | --- | --- | | `ppocrv5-mobile` | 1080x1920 | 619 | 418 | 153 | 393 / 1005 | 289 / 448 | | `ppocrv5-server` | 1080x1920 | – | 762 (fp32) | 277 | 2355 / 2901 | 1357 / 1452 | ### Startup and first call | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | --- | --- | --- | --- | --- | --- | --- | | `ppocrv5-mobile` | 1.51 | 0.27 | – | 1.82 | 2.82 | – | | `ppocrv5-server` | 2.07 | 0.56 | – | 2.03 | 1.87 | – | ### torch.compile and TensorRT | model | input | time: portable | compile | TensorRT fp16 | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `ppocrv5-mobile` | 1080x1920 | 153 ms | 115 ms | 2.68 ms | – | 75.0 s | 156 s | 289 / 448 | 292 / 448 | – | 241 / 268 | | `ppocrv5-server` | 1080x1920 | 277 ms | 277 ms | 25.1 ms | – | 105 s | 40.6 s | 1357 / 1452 | 958 / 1132 | – | 1131 / 1146 | Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB). Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or `(fp32)` where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's. ## Accuracy ### Parity with the original code Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.5 and p99 <= 1.5 (absolute error of the output `boxes`). ## Limitations - No document orientation / unwarping and no text-line orientation classifier (upside-down lines are read as they are). - The DB post-processing runs on the CPU (OpenCV-exact geometry); hole contours of the binary map are not boxed (upstream boxes them too; they rarely pass `box_threshold`). ## Usage ```python from fastforks import ocr model = ocr.load("ppocrv5-mobile") # mode="auto": the preferred backend from recorded measurements result = model("receipt.jpg") result.texts # the text lines in reading order result.boxes, result.scores # [N, 4, 2] quads in input pixels, [N] confidences result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16') ``` Install with `pip install fastforks` (see ). Other variants: `ppocrv5-mobile`, `ppocrv5-server`. ## Kernels backend No kernels backend: cuDNN convolutions are the networks; the time outside them is the per-line crop / resize and the CPU box geometry.