PP-DocLayoutV3 β€” FP16 (ONNX)

FP16 ONNX export of PP-DocLayoutV3 (25-class document layout detection with model-supplied reading order, 800Γ—800), re-exported from the PaddlePaddle/PP-DocLayoutV3_safetensors PyTorch/HF Transformers port. Produced for RailReaderCore's native WebGPU execution provider support (RailReader.Core.Analysis.WebGpu).

What this is

A drop-in FP16 replacement for the FP32 stefanj0/PP-DocLayoutV3-ONNX export (same [N,7] detection-tensor contract, including reading order) intended for GPU inference. The backbone/encoder/decoder run in FP16; the sigmoid/top-k box-decode and reading-order-vote postprocessing are kept in FP32 for numerical stability. The mask/polygon segmentation head this HF port also exposes is not included β€” RailReaderCore's consumer never reads it.

Why re-export instead of converting the existing FP32 ONNX

Post-hoc FP16 conversion of the original paddle2onnx-exported graph (via onnxconverter_common) does not work for this model β€” an iterative type-mismatch auto-fixer made progress but never converged, repeatedly re-upcasting decoder weights back toward FP32. Exporting fresh from the PyTorch/HF source avoids this: the tracer keeps every op's dtype consistent throughout. This also required one extra step beyond a plain PyTorch export: onnxsim's constant-folding, to resolve a WebGPU execution-provider graph-partitioning failure on the model's static sinusoidal position-embedding subgraph (loads fine on CPU EP either way).

Validation

Compared against the FP32 base model, on the real RailReaderCore pipeline:

metric value
block-centroid match, real document page 14/14 blocks match, sub-pixel differences only
block-centroid match, additional test page 4/4 blocks, exact match
inference speedup (WebGPU EP vs CPU EP, laptop-class GPU) ~7.3Γ—

I/O contract (identical to the FP32 base export)

  • Inputs: image float [1,3,800,800] NCHW, already letterboxed and rescaled to [0,1] (no mean/std normalization); im_shape float [1,2] (target canvas size, e.g. [800,800]); scale_factor float [1,2] (always [1,1] in this pipeline β€” kept as a real graph input for contract parity, not used numerically).
  • Output: det float [300,7] = [classId, confidence, xmin, ymin, xmax, ymax, readingOrder], no batch dimension.

25 classes matching the base PP-DocLayoutV3 label set.

Recipe

Exported with torch.onnx.export from a wrapper around PPDocLayoutV3ForObjectDetection.from_pretrained("PaddlePaddle/PP-DocLayoutV3_safetensors").half(), replicating that model's own PPDocLayoutV3ImageProcessor.post_process_object_detection and _get_order_seqs in FP32, then simplified with onnxsim. Requires transformers>=5 to load the source checkpoint (pp_doclayout_v3 isn't registered in older releases). Full reproducible tooling: tools/onnx-fp16-export/export_v3_fp16.py in RailReaderCore.

License

Inherits the license of the base model PaddlePaddle/PP-DocLayoutV3_safetensors.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for stefanj0/PP-DocLayoutV3-FP16-ONNX

Quantized
(3)
this model