PP-DocLayoutV3 safetensors Core ML (mlprogram)

Private distribution of the Core ML export for PaddlePaddle/PP-DocLayoutV3_safetensors, built for TranslateBlue on-device layout detection.

Source weights: PaddlePaddle/PP-DocLayoutV3 / PP-DocLayoutV3_safetensors.

Files

File Description
PP-DocLayoutV3-safetensors.mlpackage/ Core ML mlprogram (iOS 18+, float32)
preprocessor_config.json HF image processor contract (800×800)
conversion-status.json Export metadata
parity-report.json PyTorch vs Core ML tensor diff (smoke image)

Input / output (in-package)

Tensor Shape Dtype
pixel_values (in) [1, 3, 800, 800] float32
logits (out) [1, 300, 25] float32
pred_boxes (out) [1, 300, 4] float32 (normalized cxcywh)
order_logits (out) [1, 300, 300] float32

Preprocessing

Match PPDocLayoutV3ImageProcessor:

  • Resize to 800×800 (bicubic, antialias=False in Transformers export)
  • Rescale: pixel / 255
  • Normalize: mean [0,0,0], std [1,1,1]

See preprocessor_config.json.

Post-processing (not in Core ML)

Apply the same logic as PPDocLayoutV3ImageProcessor.post_process_object_detection in Python or Swift:

  • Sigmoid + top-k on logits
  • Reading order from order_logits
  • Optional polygon masks require full PyTorch path (masks omitted in this export)

Conversion notes

  • Export script: TranslateBlue Scripts/export_pp_doclayout_v3_safetensors_coreml/
  • numpy<2.4 required for coremltools convert (coremltools#2633)
  • compute_precision=float32 (fp16 MIL cast diverges)
  • Fixed 800×800 input (trace); other sizes are unsupported

Parity (reference)

On bus.jpg (TranslateBlue smoke):

Tensor max abs diff vs export wrapper
logits 7.2e-5
pred_boxes 9.7e-6
order_logits 0.04

License

Apache 2.0 (same family as PaddlePaddle/PP-DocLayoutV3).

Downloads last month
19
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for aoiandroid/PP-DocLayoutV3-safetensors-CoreML

Quantized
(6)
this model