Object Detection
PaddleOCR
English
Chinese
multilingual
PaddlePaddle
ocr
layout
layout_detection
reading_order
Instructions to use PaddlePaddle/PP-DocLayoutV4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PaddleOCR
How to use PaddlePaddle/PP-DocLayoutV4 with PaddleOCR:
# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle # 2. pip install paddleocr from paddleocr import LayoutDetection model = LayoutDetection(model_name="PP-DocLayoutV4") output = model.predict(input="path/to/image.png", batch_size=1) for res in output: res.print() res.save_to_img(save_path="./output/") res.save_to_json(save_path="./output/res.json") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from PaddlePaddle/PP-DocLayoutV4: direct link, hf CLI and curl.
- Browser
- Download file 19.8 kB
-
https://huggingface.co/PaddlePaddle/PP-DocLayoutV4/resolve/main/README.md
- Command line
-
hf download hf://PaddlePaddle/PP-DocLayoutV4/README.md
-
curl -L -o README.md https://huggingface.co/PaddlePaddle/PP-DocLayoutV4/resolve/main/README.md
19.8 kB
| license: apache-2.0 | |
| pipeline_tag: object-detection | |
| tags: | |
| - PaddleOCR | |
| - PaddlePaddle | |
| - object-detection | |
| - ocr | |
| - layout | |
| - layout_detection | |
| - reading_order | |
| language: | |
| - en | |
| - zh | |
| - multilingual | |
| library_name: PaddleOCR | |
| <div align="center"> | |
| <h1 align="center"> | |
| PP-DocLayoutV4: Layout Analysis Module for PaddleOCR-VL-1.8 | |
| </h1> | |
| [](https://github.com/PaddlePaddle/PaddleOCR) | |
| [](https://huggingface.co/PaddlePaddle/PP-DocLayoutV4) | |
| [](https://modelscope.cn/models/PaddlePaddle/PP-DocLayoutV4) | |
| [](https://huggingface.co/spaces/PaddlePaddle/PaddleOCR-VL-1.8_Online_Demo) | |
| [](https://modelscope.cn/studios/PaddlePaddle/PaddleOCR-VL-1.8_Online_Demo/summary) | |
| [](https://discord.gg/JPmZXDsEEK) | |
| [](https://x.com/PaddlePaddle) | |
| [](./LICENSE) | |
| **🔥 [Official Website](https://www.paddleocr.com)** | | |
| **📝 [Technical Report](https://arxiv.org/pdf/2612.04209)** | |
| </div> | |
| ## Introduction | |
| This is the PP-DocLayoutV4 model weights for the PaddlePaddle framework. Get safetensors weights at [PP-DocLayoutV4_safetensors](https://huggingface.co/PaddlePaddle/PP-DocLayoutV4_safetensors) | |
| **PP-DocLayoutV4 is a purely visual, query-based, end-to-end layout model. In a single forward pass it predicts element categories, quadrilateral boxes and reading order, and it additionally estimates page-level geometric deformation (roll, shear and perspective) so that regions on photographed, skewed or perspective-distorted pages can be rectified before recognition.** This model is the layout analysis component of PaddleOCR-VL-1.8, where it replaces PP-DocLayoutV3 with more accurate coordinates, more accurate reading order and explicit geometric modeling of deformed pages, stopping cascaded errors at the stage where they originate. | |
| ### **What's New Compared with PP-DocLayoutV3** | |
| | | PP-DocLayoutV3 | PP-DocLayoutV4 | | |
| | :-- | :-- | :-- | | |
| | Element localization | Multi-point polygons derived from a mask branch | Quadrilaterals regressed directly; the mask branch is removed | | |
| | Prediction heads | Category and box heads shared with the encoder | Each decoder layer has its own category head and quadrilateral head | | |
| | Page geometry | Not modeled | A deformation head predicts page-level roll, shear and perspective, used to rectify region images before recognition | | |
| | Reading order | A single global precedence relation | D²RO: dual-relation modeling of local successor relations and global precedence relations | | |
| ### **Model Architecture** | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/wrLCqIniwGMLoq1nObmAo.png" width="800"/> | |
| </div> | |
| Like PP-DocLayoutV3, PP-DocLayoutV4 is built on the RT-DETR framework. An HGNetV2 backbone extracts multi-scale features, a hybrid encoder (AIFI + FPN/PAN) performs intra-scale interaction and cross-scale fusion, and a Transformer decoder decodes the fused features into a set of shared element queries. Each query serves three predictions: | |
| - a **category head** outputs the element class; | |
| - a **quadrilateral head** outputs the four corners of the element; | |
| - the reading-order module **D²RO** infers the page order from pairwise relations between queries. | |
| In addition, a **deformation head** reads encoder features and predicts page-level geometric deformation parameters. | |
| ## Key Features | |
| ### Quadrilateral Representation | |
| Under the main real-world degradations (scanning, skew, perspective and screen photography), the boundary of a layout region is well approximated by a quadrilateral. Contours derived from masks, in contrast, are error-prone when adjacent regions touch, background texture interferes or the mask is fragmented, producing boxes that include neighboring elements, split one element into several pieces or have irregular boundaries. A quadrilateral has a fixed number of parameters and a strong shape prior, and does not suffer from these failure modes. | |
| - Each element is parameterized by a ten-dimensional vector `[cx, cy, Δx1, Δy1, ..., Δx4, Δy4]`: the region center plus four corner offsets. | |
| - Quadrilaterals are trained end to end without non-differentiable polygon clipping: geometric overlap is measured with a differentiable Gaussian approximation, treating each quadrilateral as a 2D Gaussian and computing overlap from the Bhattacharyya distance. | |
| - Training augmentation covers right-angle rotation, skew of up to 45°, random perspective transforms, natural-image backgrounds and random cropping, all applied consistently to the quadrilateral annotations. | |
| ### Geometric Deformation Modeling | |
| A quadrilateral can tightly enclose a skewed or perspective-distorted region, but the content inside is still distorted. The deformation head therefore predicts a page-level rectifying transform so that each region can be restored to its fronto-parallel form before recognition. | |
| - The transform is decomposed into four geometrically meaningful components: a **roll** angle, a **shear** angle, and **horizontal and vertical perspective (keystone)** coefficients. | |
| - Roll is predicted as a four-way quadrant classification (0°, 90°, 180°, 270°) plus a residual angle within ±45°; the maximum quadrant probability also serves as the confidence of page rectification. | |
| - Page rectification is **off by default**. When enabled, the rectification mode is chosen per page to avoid unnecessary resampling: | |
| 1. if the quadrant confidence is below 0.9, no rectification is applied; | |
| 2. if the residual rotation, the shear or an edge tilt reaches 2°, all regions share the page homography and are resampled and cropped individually; | |
| 3. otherwise, if the page is rotated by a multiple of 90°, only a lossless right-angle rotation is applied; | |
| 4. in all other cases the original crops are kept. | |
| ### D²RO: Local–Global Dual-Relation Reading Order | |
| A single ordering relation cannot distinguish "continuity within a block" from "precedence between blocks": on a multi-column newspaper, the many cross-region element pairs can overwhelm the few critical one-step transitions, causing the reading flow to jump elsewhere before the current content is finished. D²RO (Dual-Relation Reading Order) describes the page with two relations, both derived from the same reading indices and requiring no additional block-boundary annotation: | |
| - **Direct successor relation**: captures local one-step transitions and answers "which element is read next". | |
| - **Global precedence relation**: captures the overall precedence between elements at any distance, providing evidence when local links are missing or ambiguous and when different paths must be ordered. | |
| Successor-to-relative reconciliation (S2R) injects the multi-step precedence implied by the successor relation into the global relation scores. At inference, a local–global structural decoder builds a graph from confident successor edges, removes the lowest-confidence edge of any cycle, runs a topological sort within each connected component with ties broken by global precedence, and orders the components by their precedence votes to obtain the full reading order. | |
| ### Two-Phase Training | |
| - **Phase 1** trains the backbone, encoder, decoder, category and quadrilateral heads and D²RO, initialized from the pre-trained PP-DocLayout_plus-L weights. | |
| - **Phase 2** freezes all of them and trains only the deformation head on synthetically deformed pages with photographic degradations, so adding page-geometry estimation leaves the layout detection and reading-order outputs exactly as they were after Phase 1. | |
| ## Performance | |
| **Layout speed.** Because PP-DocLayoutV4 outputs quadrilaterals, categories and reading order directly, transferring pixel-level masks and polygon post-processing are no longer needed, reducing per-page layout time by about **52%** relative to PP-DocLayoutV3 on the same A100 GPU. | |
| **End-to-end document parsing.** The table below compares PaddleOCR-VL-1.6 (PP-DocLayoutV3) with PaddleOCR-VL-1.8 (PP-DocLayoutV4, page rectification enabled). These are system-level results: PaddleOCR-VL-1.8 also updates the recognition model weights, so the differences are not attributable to the layout model alone. | |
| | Benchmark | Metric | PaddleOCR-VL-1.6<br>(PP-DocLayoutV3) | PaddleOCR-VL-1.8<br>(PP-DocLayoutV4) | | |
| | :-- | :-- | :-: | :-: | | |
| | OmniDocBench v1.6 | Overall ↑ | 96.33 | **97.44** | | |
| | OmniDocBench v1.6 | Reading-order edit ↓ | 0.127 | **0.113** | | |
| | Real5-OmniDocBench | Overall ↑ | 93.19 | **94.67** | | |
| | Wild-OmniDocBench | Overall ↑ | 84.83 | **91.18** | | |
| | Wild-OmniDocBench | Reading-order edit ↓ | 0.1345 | **0.0635** | | |
| On the skew and warping subsets of Real5-OmniDocBench, which the quadrilateral boxes and geometric modeling of PP-DocLayoutV4 target, PaddleOCR-VL-1.8 improves over PaddleOCR-VL-1.6 by 2.12 and 2.10 points. | |
| ## Visualization | |
| ### Orientation and Perspective Rectification | |
| Input photographs next to the pages rectified with the orientation and deformation parameters predicted by PP-DocLayoutV4; detected layout regions are overlaid on both images. | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/BNFbThI-MyQuUln3LyPf5.png" width="800"/> | |
| </div> | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/77rFySHot9bJpFbXQawMJ.png" width="800"/> | |
| </div> | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/xXrf_UW3WAtgmUWFhUe2e.png" width="800"/> | |
| </div> | |
| ### Layout Detection: PP-DocLayoutV3 vs. PP-DocLayoutV4 | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/cLMjStp0MgjvyFUbMa856.png" width="800"/> | |
| </div> | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/9lsgfFSK40FRkTNV0e_60.png" width="800"/> | |
| </div> | |
| ### Reading Order: PP-DocLayoutV3 vs. PP-DocLayoutV4 | |
| Reading order is drawn as arrows between regions in predicted sequence. | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/SIDy9uVI7yRGEC8gCHixK.png" width="800"/> | |
| </div> | |
| <div align="center"> | |
| <img src="https://cdn-uploads.huggingface.co/production/uploads/684ad4f6eb7d8ee8f6a92a3a/Xs1y2AfMcjb_Bxfv-qUn_.png" width="800"/> | |
| </div> | |
| ## Citation | |
| If you find PP-DocLayoutV4 helpful, feel free to give us a star and citation. | |
| ```bibtex | |
| @misc{cui2026paddleocrvl18higheraccuracyfaster, | |
| title={PaddleOCR-VL-1.8: Higher Accuracy, Faster Inference and Broader Language Coverage for Document Parsing}, | |
| author={Cheng Cui and Zhichao Liu and Yubo Zhang and Mengjie Wang and Jiyu Zhuang and Yizhan Huang and Changda Zhou and Yannian Fu and Qunyi Xie and Xiaolong Ma and Hongbin Zhang and Yi Yang and Lei Jia}, | |
| year={2026}, | |
| eprint={2612.04209}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.CV}, | |
| url={https://arxiv.org/abs/2612.04209}, | |
| } | |
| ``` | |