ONNX - PP-DocLayout_plus-L
FP32 = pp-docLayout_plus-l.onnx
Usage
# onnxruntime-gpu for run it on GPU
pip install onnxruntime opencv-python numpy
- PP-DocLayout_plus-L/src/helper.py = onnx session builder (provider selection, threads, memory options)
- PP-DocLayout_plus-L/src/example.py = full pipeline: image preprocess, inference, box filter, label map
python3 PP-DocLayout_plus-L/src/example.py page.jpg
0.985695 | text | [79, 395, 819, 568]
0.945875 | image | [858, 511, 1128, 774]
0.944402 | paragraph_title | [81, 1472, 367, 1491]
0.835724 | header | [109, 88, 256, 130]
0.591139 | table | [837, 823, 1154, 1616]
Note:
- Input = RGB image resized to 800x800, float32 0..1, CHW with batch dimension.
- Feed =
image,im_shape(800, 800),scale_factor(800 / height, 800 / width). - Output row =
[classId, score, x1, y1, x2, y2]with coordinates already in the original image space,
the box count is in the second output. - 20 label classes (header, doc_title, text, paragraph_title, image, table, chart, formula, ...):
full map in PP-DocLayout_plus-L/src/example.py. - Boxes overlap by design (no NMS in the model): filter by score (0.3 in the example) and handle
the containment on your side if needed.