Skip to content

Fix duplicate cross-class form detections - #37

Draft
JasBogans wants to merge 1 commit into
jbarrow:mainfrom
JasBogans:agent/fix-duplicate-cross-class-detections
Draft

Fix duplicate cross-class form detections#37
JasBogans wants to merge 1 commit into
jbarrow:mainfrom
JasBogans:agent/fix-duplicate-cross-class-detections

Conversation

@JasBogans

@JasBogans JasBogans commented Jul 19, 2026

Copy link
Copy Markdown

Summary

  • enable class-agnostic NMS for the default FFDNet inference path
  • add a regression test that locks the Ultralytics prediction option in place

Problem

FFDNet currently uses Ultralytics' default class-aware NMS. When the same region
is detected as different field classes, such as a text field and a choice
button, the detections cannot suppress one another and can produce stacked
duplicate PDF fields.

Change

Pass agnostic_nms=True to the default FFDNet prediction call so strongly
overlapping detections compete regardless of predicted class. The fast ONNX
path is unchanged.

Validation

  • pytest -q: 8 passed
  • ruff check tests/inference_test.py: passed

The five existing Ruff findings in commonforms/inference.py are unchanged by
this PR.

AI assistance disclosure

This change was developed with AI assistance. All changes were reviewed and
validated by the submitter using the test suite.

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