PP-LCNet doc orientation (fastforks)
PaddleX's PP-LCNet_x1_0_doc_ori (Baidu 2025): a PP-LCNet x1.0 classifier of document page rotation, classes 0 / 90 / 180 / 270: the clockwise angle the page is turned by (turning it counter-clockwise by that angle, as PaddleX's rotate_image, makes it upright). The document preprocessor of PaddleOCR 3; ocr.scan uses it to turn pages upright.
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: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/PaddlePaddle/PaddleOCR at dab3fe353790.
Author weight repos: https://huggingface.co/PaddlePaddle/PP-LCNet_x1_0_doc_ori.
Task: classification. Tier: experimental. Outputs: logits. Backends: portable, kernels.
Input: one RGB image. Output: ImageNet-1k class logits.
Variants
Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.
| variant | weights (author link) | SHA-256 | weights licence | commercial use |
|---|---|---|---|---|
pplcnet-doc-ori@1 |
PP-LCNet_x1_0_doc_ori/inference.json PP-LCNet_x1_0_doc_ori/inference.pdiparams |
3580978602f3e8d6e7c5d264 |
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.
Training data: PaddleX describes a mix of document and certificate images; the sets are not listed..
Licence evidence: https://huggingface.co/PaddlePaddle/PP-LCNet_x1_0_doc_ori/blob/d3b95a6dff5fe8a94f2748e12b61cb26818a0df8/README.md
Input size
fixed 224x224: the input is resized (short side 256) and centre-cropped to it
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): pplcnet-doc-ori 224x224 (0.0 GiB peak allocated, 0.1 reserved)
Speed and memory
Classification, synthetic
| model | input | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|---|---|
pplcnet-doc-ori |
224x224 | 2.90 | 3.21 | 2.06 | 1.19 | 2.5x | 1.7x | 62 / 62 | 38 / 48 | 38 / 46 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
pplcnet-doc-ori |
0.61 | 1.89 | 1.82 | 0.63 | 0.61 | 0.10 |
torch.compile and TensorRT
| model | input | time: portable | compile | TensorRT (fp16 unless shown) | kernels | preparation: compile (cold first call) | ONNX + engine build | peak MiB (alloc / reserved): portable | compile | kernels | TensorRT (engine + torch) |
|---|---|---|---|---|---|---|---|---|---|---|---|
pplcnet-doc-ori |
224x224 | 2.06 ms | 1.51 ms | 0.269 ms | 1.19 ms | 5.52 s | 32.0 s | 38 / 48 | 70 / 88 | 38 / 46 | 68 / 78 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
Hardware, protocol and caveats: benchmarks (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.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.008 and p99 <= 0.015 (absolute error of the output logits).
Limitations
- The logits are log-probabilities: the exported Paddle program ends in a softmax, the runner returns its log.
- PaddleX resizes with OpenCV linear interpolation (no antialiasing, rounded sizes); fastforks resizes antialiased as the other classifiers.
Usage
from fastforks import classification
model = classification.load("pplcnet-doc-ori") # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.top(5) # top-5 classes
result.backend # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')
Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: pplcnet-doc-ori.
Kernels backend
classification.load("pplcnet-doc-ori", mode="kernels") runs our CUDA kernels (cudnn_hacc, fvm_conv, fvm_extra, fvm_mb, fvm_r3). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.