Repository navigation
Feature: box_iou - #1874
Merged
Merged
Feature: box_iou#1874
Conversation
soumik12345
suggested changes
Jul 12, 2025
soumik12345
left a comment
Contributor
There was a problem hiding this comment.
Hi @Ashp116, thanks for the valuable contribution!
I've left some feedback with respect to the function signature and documentation.
Contributor
Author
|
Hi @soumik12345, Thank you for reviewing the PR. I have addressed the changes requested and updated the docs to display |
soumik12345
suggested changes
Jul 12, 2025
soumik12345
left a comment
Contributor
There was a problem hiding this comment.
Hi @Ashp116, I have one more minor feedback.
@SkalskiP / @onuralpszr can you please take a look at this PR as well?
soumik12345
approved these changes
Jul 14, 2025
SkalskiP
approved these changes
Jul 14, 2025
2 tasks done
Collaborator
|
Hi @Ashp116, are you on LinkedIn / X? I'd like to mention you in supervision-0.26.0 release post. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a lightweight function
box_iouthat efficiently computes the Intersection over Union (IoU) between two individual bounding boxes. The motivation behind this addition is to avoid unnecessary overhead caused by thebox_iou_batchfunction when used in one-to-one comparisons.While
box_iou_batchis suitable for batch operations, it's inefficient for scenarios involving many single-pair IoU computations. In my case, I was building a DAG structure that required repeated one-to-one IoU evaluations, and using the batch function resulted in nearly 2× slower total compute time. The newbox_ioufunction significantly improves performance in such use cases. Refer to #1873 for more details.Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
Tested locally by comparing the output of
box_iouwithbox_iou_batchfor several individual box pairs to ensure correctness. Also benchmarked performance usingtimeitand confirmed thatbox_iouis ~2x faster for many one-to-one evaluations.Any specific deployment considerations
None.
Docs