CoolFace
Modelpublic

rageyu/platen2-pdf-doclayout

sourceHugging Faceapache-2.0updated 15d agoView on Hugging Face
0likes30downloads
Model Card

PP-DocLayoutV2 (detection half) — Core ML

Baidu's PP-DocLayoutV2 document-layout detector, converted to Core ML. One RT-DETR forward pass over a page image returns 300 candidate regions across 25 classes — including algorithm, reference_content, abstract and display_formula, which is why it is useful where a coarser vocabulary is not.

Input1×3×800×800, RGB, values 0–1 (no mean/std)
Outputslogits [1,300,25] · boxes [1,300,4] cxcywh, page-normalised
Size63 MB (fp16)
Speed~14 ms per page on an M5 Max

Detection only. PP-DocLayoutV2 also carries a reading-order head; it is not included here, and reading order should come from the document's own text layer.

Provenance and changes

Converted from PaddlePaddle/PP-DocLayoutV2, the publisher's own release. The weights are unmodified. That repo publishes a Paddle inference export rather than a checkpoint, so the deploy form was carried across as-is: RepVGG blocks stay folded, q/k/v stays one fused projection, and the auxiliary classification heads are pruned to the one the detection path reads.

Two rewrites were needed for Core ML, neither touching a weight:

  • shape values folded to constants, since the 800×800 input makes them constant
  • multi-scale deformable attention rewritten to stay at rank 5 by slicing the level before sampling_locations is built rather than after

Notes for implementers

  • Outputs are padded to a 64-byte row. Read by stride.
  • Per-class score thresholds, not one global floor: text, paragraph_title, doc_title and the formula classes clear at 0.4, seal at 0.45, everything else at 0.5.
  • Some high-scoring queries decode to zero-area boxes. Drop them.

Licence

Apache License 2.0, inherited from PaddlePaddle. Copyright (c) PaddlePaddle Authors. Converted to Core ML by tekl; weights unmodified, serialisation and graph form changed as described above.