Skip to content

Normalize list-returning detection models#516

Draft
CyMule wants to merge 2 commits into
mainfrom
fix/normalize-detector-results
Draft

Normalize list-returning detection models#516
CyMule wants to merge 2 commits into
mainfrom
fix/normalize-detector-results

Conversation

@CyMule

@CyMule CyMule commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • normalize legacy list results from object-detection models into LayoutElements
  • perform normalization at the shared model boundary
  • update Detectron coverage and add a page-layout regression test

Why

Some built-in detection models return a list while page layout code expects LayoutElements and reads attributes such as routing. That mismatch can raise AttributeError in a normal inference route.

Compatibility note

The shared object-detection call now consistently returns LayoutElements. Out-of-tree callers that directly consumed a raw list should use .as_list() when they need the prior shape. The draft status leaves room to confirm that boundary contract.

Validation

  • uv run --locked --no-sync pytest -q test_unstructured_inference/inference/test_layout.py test_unstructured_inference/models/test_detectron2onnx.py — 59 passed
  • Ruff check and format check passed for all changed Python files
  • changelog and package versions both set to 1.6.14

Review in cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant