Skip to content

[utils] Keep boxes without any area in nms - #2194

Merged
felixdittrich92 merged 1 commit into
mindee:mainfrom
RavSinghChandan:nms-zero-area-boxes
Oct 30, 2026
Merged

felixdittrich92 merged 1 commit into
mindee:mainfrom
RavSinghChandan:nms-zero-area-boxes

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

nms divided the intersection by the union without a guard. For two boxes without any area (collapsed to a point or a line), that is 0 / 0: NumPy warned invalid value encountered in divide, and since nan <= thresh is false, the second box was suppressed even when the two boxes are far apart. Three such boxes at different places gave [0].

The overlap is now 0 when the union is empty, as box_iou already does, so those boxes are kept. Boxes with an area give the same result as before

@felixdittrich92 felixdittrich92 self-assigned this Oct 30, 2026
@felixdittrich92 felixdittrich92 added type: enhancement Improvement module: utils Related to doctr.utils ext: tests Related to tests folder labels Oct 30, 2026
@felixdittrich92 felixdittrich92 added this to the 1.2.0 milestone Oct 30, 2026
@felixdittrich92
felixdittrich92 merged commit 6802eb8 into mindee:main Oct 30, 2026
54 checks passed
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.74%. Comparing base (9ae237d) to head (e5bd8dd).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2194      +/-   ##
==========================================
- Coverage   97.75%   97.74%   -0.01%     
==========================================
  Files         170      170              
  Lines       10959    10962       +3     
==========================================
+ Hits        10713    10715       +2     
- Misses        246      247       +1     
Flag Coverage Δ
unittests 97.74% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

ext: tests Related to tests folder module: utils Related to doctr.utils type: enhancement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants