--- license: other license_name: pp-doclayoutv4 license_link: https://github.com/omnidocai/PP-DocLayoutV4/blob/main/NOTICE library_name: onnx pipeline_tag: object-detection tags: - document-layout-analysis - reading-order - onnx - openvino - paddlepaddle - pp-doclayoutv4 --- # PP-DocLayoutV4 (ONNX and Paddle) Document layout analysis with **PP-DocLayoutV4**: 25 layout classes, a four-point box per region and the reading order of the page. Code (Python on ONNX Runtime, OpenVINO or PaddlePaddle; Rust on ONNX Runtime), results and paper: **[github.com/omnidocai/PP-DocLayoutV4](https://github.com/omnidocai/PP-DocLayoutV4)** ยท [omnidoc.top](https://omnidoc.top) | file | what | bytes | SHA-256 | |---|---|---|---| | `PP-DocLayoutV4.onnx` | the official inference graph exported to ONNX (opset 17, FP32) for ONNX Runtime and OpenVINO: CPUs from Intel and AMD, NVIDIA, AMD and Intel GPUs, Intel NPUs | 153,111,775 | `800db25f046af9395f7acde36c51a93fe2fce8019cfbb1bacb5a663d83a4c233` | | `PP-DocLayoutV4_infer/inference.json` | the official Paddle inference model (PaddlePaddle 3): graph | 1,272,437 | `ab841469f943b754d4e93d43bf90899274d266b1f28e439197bc7199dd146d07` | | `PP-DocLayoutV4_infer/inference.pdiparams` | weights | 132,771,206 | `7d6057d36b99d2f8f8df39e173f10efd5eff512196620c7912b8d29172bc4f88` | | `PP-DocLayoutV4_infer/inference.yml` | pre-processing and labels | 1,482 | `12073ce49d0f7c96fc5ad5ebda2098267913b6b4a21fe453a9085765034ee408` | ## Use ```bash git clone https://github.com/omnidocai/PP-DocLayoutV4 && cd PP-DocLayoutV4 python download_model.py all # these files, SHA-256 checked (HF_ENDPOINT for a mirror) bash run.sh page.png scans/ paper.pdf -o out --vis # ONNX Runtime, CPU V4_RUNTIME=paddle-gpu bash run.sh scans/ -o out --device paddle:gpu # the Paddle model, NVIDIA GPU ``` Each page gives a JSON with the regions in reading order: class, score, box and four-point box. Rust: `cd rust && cargo build --release && target/release/pp-doclayoutv4 page.png -o out --model ../PP-DocLayoutV4.onnx`. ## Results On 470 public pages, ONNX Runtime on an Intel CPU and an NVIDIA GPU and OpenVINO on the CPU return the regions of official Paddle inference (9,845 regions: none lost, added or reclassified, reading order unchanged); on the 110 annotated pages of PaddleX's own layout demo dataset every runtime scores what official Paddle scores (mAP 36.18 at IoU 0.50:0.95). Details, speed and the paper: see the GitHub repository. ## License PP-DocLayoutV4 is a model by the PaddlePaddle team; these files are its official inference model and an ONNX export of it, redistributed by OmniDoc and subject to the PaddlePaddle team's terms for the model. The ONNX file is the official inference graph exported with paddle2onnx, with added operators that leave every output unchanged (checked bit for bit with ONNX Runtime CPU, OpenVINO CPU and ONNX Runtime CUDA). The code on GitHub is Apache-2.0.