Skip to content

feat: rtree_rotated_nms#76

Merged
Smirkey merged 3 commits into
Smirkey:mainfrom
gcanat:rtree_rotated_nms
Mar 11, 2026
Merged

feat: rtree_rotated_nms#76
Smirkey merged 3 commits into
Smirkey:mainfrom
gcanat:rtree_rotated_nms

Conversation

@gcanat
Copy link
Copy Markdown
Collaborator

@gcanat gcanat commented Mar 10, 2026

Ready for review I think.

  • added Rtree nms for rotated boxes
  • added a fast path to rotated_nms: check if envelopes interesect before computing expensive rotated intersection (2x speed-up it seems)
  • factorized the filtering and sorting of boxes into filter_and_sort_scores function. Took the liberty of removing the n argument from the axis-aligned nms functions (hope it's ok)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 10, 2026

Merging this PR will improve performance by ×2.8

⚡ 21 improved benchmarks
✅ 146 untouched benchmarks
🆕 8 new benchmarks
⏩ 1 skipped benchmark1

Performance Changes

Benchmark BASE HEAD Efficiency
test_rotated_nms[float64] 278.1 µs 151.8 µs +83.2%
test_rotated_nms[int16] 285.3 µs 153.1 µs +86.41%
test_rotated_nms[float32] 291.1 µs 151.3 µs +92.4%
test_rotated_nms[int64] 288.2 µs 151.4 µs +90.38%
test_rotated_nms_many_boxes[10000] 2.8 s 1.2 s ×2.3
test_rotated_nms[int32] 284.9 µs 150.1 µs +89.83%
test_rotated_nms[uint64] 372.7 µs 226.7 µs +64.37%
test_rotated_nms[uint32] 309.7 µs 158.6 µs +95.22%
test_rotated_nms[uint8] 314.7 µs 182.5 µs +72.39%
test_rotated_nms[uint16] 304.1 µs 156.2 µs +94.71%
test_rtree_nms[int32] 144.4 µs 88.6 µs +62.98%
test_rtree_nms[int16] 129.4 µs 82.9 µs +56.22%
test_rtree_nms_many_boxes[10000] 20.5 ms 7.6 ms ×2.7
test_rtree_nms[int64] 148.4 µs 92.1 µs +61.17%
test_rotated_nms_many_boxes[5000] 691.8 ms 291.2 ms ×2.4
test_rotated_nms_many_boxes[1000] 28.9 ms 12.3 ms ×2.4
test_rtree_nms[float64] 151.2 µs 91.6 µs +64.99%
test_rtree_nms[float32] 153.6 µs 90.2 µs +70.42%
🆕 test_rtree_rotated_nms[int32] N/A 119.9 µs N/A
test_rtree_nms_many_boxes[20000] 44.1 ms 15.9 ms ×2.8
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing gcanat:rtree_rotated_nms (350cf98) with main (5e3b449)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 99.04762% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.00%. Comparing base (db09f08) to head (350cf98).
⚠️ Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
powerboxesrs/src/nms.rs 98.58% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #76      +/-   ##
==========================================
- Coverage   98.77%   95.00%   -3.78%     
==========================================
  Files          17       13       -4     
  Lines        2703     2745      +42     
==========================================
- Hits         2670     2608      -62     
- Misses         33      137     +104     

☔ View full report in Codecov by Sentry.
📢 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.

@gcanat gcanat marked this pull request as ready for review March 10, 2026 21:39
@Smirkey Smirkey self-requested a review March 11, 2026 10:06
Copy link
Copy Markdown
Owner

@Smirkey Smirkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, will have a deeper look this we
i'll probably add a test against torch nms to verify we're correct,
been doing this manually, it's not great

@Smirkey Smirkey merged commit 36f9834 into Smirkey:main Mar 11, 2026
18 of 19 checks passed
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.

2 participants