PP DocLayoutV2

ProviderPaddlePaddle
Categoryobject-detection
Licenseapache-2.0
Downloads175.0K
Stars2

Overview

PP DocLayoutV2 is a specialized object detection model designed for high-precision document layout analysis. Unlike general-purpose detectors, it is optimized to identify and segment structural elements within complex documents—such as tables, figures, headers, and text blocks—making it a critical component for advanced RAG pipelines and OCR workflows. For developers, this means more reliable document parsing and better data extraction from PDFs or scanned images. It integrates seamlessly into the PaddlePaddle ecosystem and is released under the Apache-2.0 license, offering the flexibility needed for commercial deployment. Compared to standard layout engines, it provides a more robust balance between inference speed and boundary accuracy for diverse document formats.

Highlights

  • Optimized for complex document structural element detection
  • Essential for enhancing RAG and OCR data extraction
  • Apache-2.0 license allows flexible commercial integration
  • High-precision boundary detection for tables and figures
  • Native integration with the PaddlePaddle deep learning framework

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("PaddlePaddle/PP-DocLayoutV2")
tokenizer = AutoTokenizer.from_pretrained("PaddlePaddle/PP-DocLayoutV2")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download PaddlePaddle/PP-DocLayoutV2

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download PaddlePaddle/PP-DocLayoutV2 config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('PaddlePaddle/PP-DocLayoutV2')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/PaddlePaddle/PP-DocLayoutV2

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/PaddlePaddle/PP-DocLayoutV2

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('PaddlePaddle/PP-DocLayoutV2')
tokenizer = AutoTokenizer.from_pretrained('PaddlePaddle/PP-DocLayoutV2')

Model Download

We recommend downloading the model via the ModelScope CLI or SDK.

Guidance:Before downloading, install ModelScope with:

Guidance
pip install modelscope

CLI Download

Download the full repository

Download the full repository
modelscope download --model PaddlePaddle/PP-DocLayoutV2

Download a single file to a local folder (e.g. README.md into ./dir)

Download a single file to a local folder (e.g. README.md into ./dir)
modelscope download --model PaddlePaddle/PP-DocLayoutV2 README.md --local_dir ./dir

See the docs for more CLI options

SDK Download

SDK Download
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('PaddlePaddle/PP-DocLayoutV2')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://www.modelscope.cn/PaddlePaddle/PP-DocLayoutV2.git

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/PaddlePaddle/PP-DocLayoutV2.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook Quickstart

Install the ModelScope library

Install the ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

Load the model and run inference

Load the model and run inference
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'PaddlePaddle/PP-DocLayoutV2')

Full Documentation

来源: HuggingFace

---
license: apache-2.0
pipeline_tag: object-detection
tags:

  • PaddleOCR

  • PaddlePaddle

  • ocr

  • layout

  • layout_detection

language:
  • en

  • zh

  • multilingual

library_name: PaddleOCR
---

Introduction

PP-DocLayoutV2 is a dedicated lightweight model for layout analysis, focusing specifically on element detection, classification, and reading order
prediction.

Model Architecture

PP-DocLayoutV2 is composed of two sequentially connected networks. The first is an RT-DETR-based detection model that performs layout element detection and classification. The detected bounding boxes and class labels are then passed to a subsequent pointer network, which is responsible for ordering these layout elements.

<div align="center">
<img src="https://huggingface.co/datasets/PaddlePaddle/PaddleOCR-VL_demo/resolve/main/imgs/PP-DocLayoutV2.png" width="800"/>
</div>

Usage

Install Dependencies

Install PaddlePaddle and PaddleOCR:

bash
python -m pip install paddlepaddle-gpu==3.2.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
python -m pip install -U "paddleocr[doc-parser]"
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/cu126/safetensors/safetensors-0.6.2.dev0-cp38-abi3-linux_x86_64.whl

> For Windows users, please use WSL or a Docker container.

Basic Usage

Python API usage:

python
from paddleocr import LayoutDetection

model = LayoutDetection(model_name="PP-DocLayoutV2")
output = model.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/layout.jpg", batch_size=1, layout_nms=True)
for res in output:
res.print()
res.save_to_img(save_path="./output/")
res.save_to_json(save_path="./output/res.json")

For more usage details and parameter explanations, see the documentation.

Citation

If you find PaddleOCR-VL helpful, feel free to give us a star and citation.

bibtex
@misc{cui2025paddleocrvlboostingmultilingualdocument,
      title={PaddleOCR-VL: Boosting Multilingual Document Parsing via a 0.9B Ultra-Compact Vision-Language Model}, 
      author={Cheng Cui and Ting Sun and Suyin Liang and Tingquan Gao and Zelun Zhang and Jiaxuan Liu and Xueqing Wang and Changda Zhou and Hongen Liu and Manhui Lin and Yue Zhang and Yubo Zhang and Handong Zheng and Jing Zhang and Jun Zhang and Yi Liu and Dianhai Yu and Yanjun Ma},
      year={2025},
      eprint={2510.14528},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2510.14528}, 
}
Join our Telegram