Models · Classification

PP-LCNet doc orientation

PP-LCNet document orientation (Baidu PaddlePaddle, PaddleOCR 3): a small CPU-friendly CNN that tells whether a page photo is turned 0, 90, 180 or 270 degrees, so it can be turned upright before OCR. Apache-2.0 code and weights.

experimental Fork of PaddlePaddle/PaddleOCR@dab3fe3 · backends: portable, kernels

Checkpoint pplcnet-doc-ori

Paper 2021 Added in 0.4.0

Kernels, RTX 5060 Ti 16 GB 1.19 ms 224x224, fp16
vs the faster original 2.5× original fp32: 2.90 ms
Peak memory 38 MiB original: 68 MiB
Accuracy vs original fp32 – no test-set run

Use it

pip install fastforks

Lean install with only what this model needs: pip install "fastforks-core[timm]"

from fastforks import classification

model = classification.load("pplcnet-doc-ori")  # fastest backend that runs here
result = model("photo.jpg")

# result fields: logits
logits = result.logits  # a torch tensor
arrays = result.numpy()  # the tensor fields as NumPy arrays: arrays["logits"]
result.backend  # what ran: mode, device, dtype
Other ways to run it
  • Backend: classification.load("pplcnet-doc-ori", mode="kernels") # or "portable", "auto" (default)
  • Precision: classification.load("pplcnet-doc-ori", dtype="float32") # full precision: slower, portable only
fastforks bench pplcnet-doc-ori

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

Input: synthetic, 224x224 (the task’s standard size)

BackenddtypeTime per call (ms)vs original fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32paddlepaddle 3.3.1 paddle.inference GPU; original code, authors' host-side pre/post-processing; memory = this process' NVML GPU memory above the idle CUDA context (the predictor's own pools)fp32 2.90–68 MiB/68 MiB0.40.35
Original fp16paddlepaddle 3.3.1 paddle.inference GPU; original code, authors' host-side pre/post-processing; memory = this process' NVML GPU memory above the idle CUDA context (the predictor's own pools)fp16 3.210.90×62 MiB/62 MiB0.60.63
Portable fp32fp32not measured ––––
Portablefp16 2.061.4×38 MiB/48 MiB1.90.61
Kernelsfp16 1.192.5×38 MiB/46 MiB1.80.10
Portable + torch.compile 1.511.9×70 MiB/88 MiB6 (build)–
TensorRT fp16fp16 0.26911×32 MiBenginenot comparable32 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-29 to 2026-11-30. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryLoad / first call (s)Output vs referenceInput
Apple silicon runs on macOS
Apple M1 Pro 16 GB (MLX, fp16) MLX, torch 2.14.1, 2026-11-30Portablefp163.16 341 MiB process1.2 / 0.1differs224x224
Portablefp323.01 336 MiB process1.7 / 0.3differs224x224

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
Apache-2.0
Weights
Apache-2.0 source
Training data
PaddleX describes a mix of document and certificate images; the sets are not listed.

Our reading of the licences, not legal advice.

Weights

PP-LCNet_x1_0_doc_ori/inference.json 104 KB· hosted on Hugging Face
PP-LCNet_x1_0_doc_ori/inference.pdiparams 6.8 MB· hosted on Hugging Face

fastforks downloads and checks these files on first use (fastforks download pplcnet-doc-ori).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

Accuracy not measured for pplcnet-doc-ori.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 not recorded
GPU default dtypes, mean |diff|≤ 0.008 0.00145
GPU default dtypes, p99 |diff|≤ 0.015 0.00298

Recorded for pplcnet-doc-ori on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-27, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3

Details

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.

Input / output
Input: one RGB image. Output: ImageNet-1k class logits.
Input size
fixed 224x224: the input is resized (short side 256) and centre-cropped to it; tested up to 224x224 (38 MiB allocated)
Outputs
logits
CUDA kernels
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
  • fvm_convfused convolutions for image classifiers
  • fvm_extrafused transformer row operations (rotary split, SwiGLU with LayerNorm)
  • fvm_mbfused MBConv blocks (MobileNet and EfficientNet families)
  • fvm_r3further fused classifier blocks
Apple (MPS)
fp32, fp16

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.
Full reference, generated from the repository

PP-LCNet document orientation (Baidu PaddlePaddle, PaddleOCR 3): a small CPU-friendly CNN that tells whether a page photo is turned 0, 90, 180 or 270 degrees, so it can be turned upright before OCR. Apache-2.0 code and weights.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
pplcnet-doc-orisynthetic (224x224)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
2.90
3.21
2.06
1.19
1.51
0.269
68 / 68
62 / 62
38 / 48
38 / 46
70 / 88
68 / 78
Details
  • Original code: https://github.com/PaddlePaddle/PaddleOCR at dab3fe353790
  • Code licence: Apache-2.0 (permissive); files:
  • Weights licence: Apache-2.0
  • Licence evidence: https://huggingface.co/PaddlePaddle/PP-LCNet_x1_0_doc_ori/blob/d3b95a6dff5fe8a94f2748e12b61cb26818a0df8/README.md
  • Training data: PaddleX describes a mix of document and certificate images; the sets are not listed.
  • Kernel libraries: cudnn_hacc, fvm_conv, fvm_extra, fvm_mb, fvm_r3
  • Variants: pplcnet-doc-ori
  • Outputs: logits; label_set: page-orientation-4
  • 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)
  • pplcnet-doc-ori 224x224, first call: portable + torch.compile 6 s (cold Inductor cache), TensorRT fp16 32 s (ONNX + engine).
  • pplcnet-doc-ori original (fp32) 224x224, original 224x224: paddlepaddle 3.3.1 paddle.inference GPU; original code, authors' host-side pre/post-processing; memory = this process' NVML GPU memory above the idle CUDA context (the predictor's own pools)
  • pplcnet-doc-ori load / first call: original 0.61 s / 0.63 s, portable 1.89 s / 0.609 s, kernels 1.82 s / 0.099 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Parity

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).

variantkernels error vs original, mean / p99GPU, torchkernels used
pplcnet-doc-ori0.00145 / 0.00298RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120

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.

Example output

No example rendered for this checkpoint yet.