Skip to content

feat: add a tract backend for classical PaddleOCR with a bounded shape-keyed plan cache #1354

Description

@Haoxincode

What is the proposed feature?

Complete the tract follow-up left by #1275 and #1282 for classical PaddleOCR:

  • Route DBNet, CRNN, and AngleNet in xberg-paddle-ocr through the shared InferenceBackend seam.
  • Add a bounded shape-keyed tract plan cache for DBNet and CRNN dynamic inputs.
  • Expose an explicit no-ORT Cargo feature, for example paddle-ocr-tract (exact naming is up to the maintainers).
  • Keep the existing paddle-ocr / ONNX Runtime path as the native default.
  • Add ORT/tract parity tests for PP-OCRv5 and PP-OCRv6 fixtures.
  • Document cache limits, eviction behavior, memory use, warm latency, and unsupported model combinations.

Suggested acceptance criteria:

  • The no-ORT PaddleOCR feature's dependency tree does not contain ort.
  • PP-OCRv5/v6 detection, classification, and recognition pass fixed corpus tests.
  • Text, boxes, confidence, and reading-order differences from the ORT baseline have documented tolerances.
  • The plan cache has a capacity or memory budget, deterministic eviction behavior, and documented concurrency semantics.
  • Shape misses, unsupported models, and resource-limit failures return explicit errors or diagnostics.
  • Benchmarks cover first load, cache hit, cache miss, peak memory, and CPU latency.

Why would this be a good addition?

The v1.0.5 pure-Rust inference documentation says DBNet and CRNN already achieve strong numerical parity with ONNX Runtime, while the remaining blocker is dynamic-shape plan reuse. AngleNet is fixed-shape and can already run through tract.

The current xberg-paddle-ocr crate still depends directly on ort and stores ort::session::Session, so users cannot deploy classical PP-OCR as a pure-Rust Rust crate even when GPU execution providers are not needed.

A separate explicit feature would support simpler offline and embedded Rust distribution without changing the existing native default. This request is intentionally limited to classical PaddleOCR; TATR, PP-DocLayout-V3, and SLANeXT have separate tract operator/model constraints.

Related context:

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestv1.1.0Targeted for the v1.1.0 release

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions