PP-DocLayoutV3
PP-DocLayoutV3 是 PaddleOCR 的文档版面检测器。它找出页面上的各类区域(正文、标题、表格、图、公式、页眉、页脚、印章等),并按阅读顺序排序。LibreYOLO 把它移植为一个 detect 家族,不需要 transformers 或 PaddlePaddle 运行时。
- 任务
- detection
- 尺寸
- l at 800 px
- 安装
pip install libreyolo- 支持层级
- 仅推理,自 v1.8.0 起。仅支持预测、验证和导出。训练相关的功能不适用。
- 许可
- 代码采用 Apache-2.0,权重采用 Apache-2.0。商用
安装
PP-DocLayoutV3 不需要任何可选 extra。它是纯 PyTorch,导入的一切都在基础安装里。
pip install libreyolo预测
权重在首次使用时从 LibreYOLO/LibrePPDocLayoutV3l 下载。
from libreyolo import LibreYOLO model = LibreYOLO("LibrePPDocLayoutV3l.pt")result = model("page.png", conf=0.5) # 上游流水线的阈值 for order, box, cls, score in zip( result.reading_order, result.boxes.xyxy, result.boxes.cls, result.boxes.conf): print(int(order), result.names[int(cls)], round(float(score), 3), box.tolist())libreyolo predict model=LibrePPDocLayoutV3l.pt source=page.png conf=0.5 save=Truefrom libreyolo import LibreYOLO # 上游的 model.safetensors 也能加载:它会被转换一次,# 并在旁边写出一个 LibreYOLO 检查点model = LibreYOLO("model.safetensors")Results.boxes 存放原始页面上的 xyxy 检测框、置信度和 25 个版面类别的类别 id。各行
按阅读顺序排序,Results.reading_order 是一个与检测框对齐、从 1 开始的 int64 向量。
它和 track_id 一样可以用 results[i] 切片,并以 reading_order 出现在
Results.summary() 的行里。排名是在 conf 过滤后保留的区域之间计算的;classes=
过滤或 max_det 截断会保留剩余区域原来的排名,所以这些值可能不连续。
上游流水线使用 conf=0.5;LibreYOLO 默认的 conf=0.25 会保留更多低置信度区域。
与上游一样,分数是逐类别的 sigmoid,保留前 300 个(query, class)对,所以同一个区域
可能带着两个标签出现。不做 NMS。
类别:abstract、algorithm、aside_text、chart、content、
display_formula、doc_title、figure_title、footer、footer_image、
footnote、formula_number、header、header_image、image、
inline_formula、number、paragraph_title、reference、
reference_content、seal、table、text、vertical_text、
vision_footnote。
在 layout=True 时,Falcon OCR 的版面阶段运行的也是
这个移植版。
变体
只有一个尺寸,l:一个 RT-DETR 风格的集合预测检测器,采用 HGNetV2-L 骨干、掩码增强
的 query 初始化,以及一个为每对区域打分的 global-pointer head。输入是固定的 800x800
画布(拉伸缩放,RGB 取值 [0, 1],不做归一化)。它可以在 CPU、CUDA 和 MPS 上运行;
在 MPS 上位置编码以 float32 计算,所以结果在最后几位上可能不同。
与 transformers 里采用 Apache-2.0 许可的 PyTorch 参考实现相比,在 CUDA 上以 fp32、 相同输入张量运行时,logits、检测框、阅读顺序 logits 和掩码在三张真实页面和一个随机 张量上完全一致。不提供训练:训练需要阅读顺序和逐区域掩码的监督信号,而 LibreYOLO 的 detect 数据集不带这些。上游从掩码分支推导出的逐区域多边形没有暴露出来。
导出
| 任务 | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | Axelera | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Detection | Detection to ONNX:支持 | Detection to TorchScript:支持 | Detection to ExecuTorch:支持 | Detection to TensorRT:支持 | Detection to OpenVINO:支持 | Detection to Paddle:不支持 | Detection to MNN:不支持 | Detection to RKNN:不支持 | Detection to Axelera:不支持 | Detection to ncnn:不支持 | Detection to TFLite:不支持 | Detection to CoreML:不支持 | Detection to Core AI:不支持 |
ONNX(opset 17)和 TorchScript,固定 800x800,FP32。计算图输出 pred_logits、
pred_boxes 和 order_votes;导出后的后端返回同样的 Results,包括
reading_order。
from libreyolo import LibreYOLO model = LibreYOLO("LibrePPDocLayoutV3l.pt")model.export(format="onnx") # 固定 800x800,FP32model.export(format="torchscript")libreyolo export model=LibrePPDocLayoutV3l.pt format=onnxfrom libreyolo import LibreYOLO model = LibreYOLO("LibrePPDocLayoutV3l.onnx")result = model("page.png", conf=0.5)print(result.reading_order)检查点
| 文件 | 输入(px) | 权重许可 |
|---|---|---|
| Detection | ||
| LibrePPDocLayoutV3l.pt | 800 | apache-2.0 |
上面的每个文件目前都在 LibreYOLO 组织中,并会在首次使用时下载。
许可证
请检查你所下载的具体权重在 Hugging Face 仓库中的许可。LibreYOLO 组织里的每个检查点都附有许可,同一家族内也不一定相同。该仓库是权威来源;以下摘要说明本页上次验证时适用的情况。
这里只说明涉及的许可证,不构成法律意见。如果答案对商用很重要,请自行阅读许可证并咨询法律顾问。
- 原始工作
- PP-DocLayoutV3, PaddlePaddle Authors
- 上游许可
- Apache-2.0
- LibreYOLO 代码
- MIT
- 权重
- 采用 Apache-2.0 许可,重新发布在 huggingface.co/LibreYOLO
- 解读
- Apache-2.0 is a permissive license, so the PP-DocLayoutV3 weights and LibreYOLO's port can be used in commercial and closed-source products. Redistributing them means keeping the license text and attribution notices, and the license grants a patent license. LibreYOLO's network is an inference-only PyTorch port of the Apache-2.0 reference in Hugging Face Transformers (v5.22.1, commit 446a570e62b04a89ea001604ada7366baac2ea67, Copyright The PaddlePaddle Team and The HuggingFace Inc. team) and needs no transformers runtime (libreyolo/models/ppdoclayoutv3/NOTICE). The checkpoint is converted from PaddlePaddle/PP-DocLayoutV3_safetensors at revision e4f489dc536556fc1be02b973ba06756e0d4a2ac, declared Apache-2.0 by its model card; that repository ships no LICENSE file, so the mirror at LibreYOLO/LibrePPDocLayoutV3l carries the Apache-2.0 text of the PaddleOCR project. Conversion only strips a key prefix and adds metadata; learned parameters are unchanged, and the mirror is not gated.
PP-DocLayoutV3 的代码和权重都采用 Apache-2.0 许可,出自
PaddlePaddle Authors。允许商用。
检查点(checkpoint)由 PaddlePaddle/PP-DocLayoutV3_safetensors 转换而来,只去掉了
一个键前缀并添加了元数据;学到的参数没有改动,镜像不需要申请访问。
引用
@misc{cui2026rtdoclayoutrealtimeendtoenddocument,
title={RT-DocLayout: Real-Time End-to-End Document Layout Analysis with Reading Order in the Wild},
author={Cheng Cui and Tingquan Gao and Xueqing Wang and Changda Zhou and Hongen Liu and Ting Sun and Yubo Zhang and Zelun Zhang and Jiaxuan Liu and Manhui Lin and Yue Zhang and Suyin Liang and Yiqing Xiang and Yi Liu},
year={2026},
eprint={2606.23344},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2606.23344},
}复制自作者在 huggingface.co/PaddlePaddle/PP-DocLayoutV3_safetensors#citation 上提供的引用块。