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.
| Input | 1ร3ร800ร800, RGB, values 0โ1 (no mean/std) |
| Outputs | logits [1,300,25] ยท boxes [1,300,4] cxcywh, page-normalised |
| Size | 63 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_locationsis 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_titleand the formula classes clear at 0.4,sealat 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.
- Downloads last month
- -
Model tree for rageyu/platen2-pdf-doclayout
Base model
PaddlePaddle/PP-DocLayoutV2