Skip to content

[fix] Handle zero-width horizontal crops - #2173

Open
AryanRG wants to merge 1 commit into
mindee:mainfrom
AryanRG:fix/zero-width-horizontal-crops
Open

AryanRG wants to merge 1 commit into
mindee:mainfrom
AryanRG:fix/zero-width-horizontal-crops

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 16, 2026

Copy link
Copy Markdown

Summary

  • handle degenerate zero-width quadrilaterals in horizontal crop extraction without raising IndexError;
  • return the existing empty-crop placeholder so the predictor's current filtering keeps crops, boxes, and objectness scores aligned;
  • cover direct geometry behavior plus mixed and all-collapsed OCR/KIE predictor paths.

The oriented crop path is unchanged. Boxes with NaN x coordinates also produce an empty crop instead of the previous IndexError; broader non-finite polygon validation is outside this patch.

Validation

  • regression before fix: 12 expected IndexErrors, with 8 oriented controls passing;
  • revised regression and OCR/KIE integration nodes: 20 passed;
  • complete geometry module: 56 passed;
  • focused predictor selection: 7 passed;
  • builders: 40 passed;
  • adjacent detection/recognition utilities: 74 passed;
  • dataset crop caller: 2 passed;
  • existing OCR/KIE predictor nodes: 10 passed;
  • pre-commit, Ruff check/format, git diff --check, and mypy doctr/ passed.

The broader local make test run stopped after 159 passes because WeasyPrint could not load the host's missing libgobject-2.0-0 native library. A standalone WeasyPrint import fails identically, so full-suite and coverage equivalence are not claimed.

This branch has not been deployed

No deployments
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