Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c78ae33
feat: 🚀 Added Non-Maximum Merging to Detections
Oct 13, 2023
57b12e6
Added __setitem__ to Detections and refactored the object prediction …
Oct 18, 2023
9f22273
Added standard full image inference after sliced inference to increas…
Oct 18, 2023
6f47046
Refactored merging of Detection attributes to better work with np.nda…
Oct 18, 2023
5f0dcc2
Merge branch 'develop' into add_nmm_to_detections to resolve conflicts
Apr 9, 2024
166a8da
Implement Feedback
Apr 11, 2024
b159873
Merge remote-tracking branch 'upstream/develop' into add_nmm_to_detec…
May 6, 2024
d7e52be
NMM: Add None-checks, fix area normalization, style
May 6, 2024
bee3252
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] May 6, 2024
97c4071
NMM: Move detections merge into Detections class.
May 6, 2024
204669b
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] May 6, 2024
2eb0c7c
Merge remote-tracking branch 'upstream/develop' into add_nmm_to_detec…
LinasKo May 14, 2024
c3b77d0
Rename, remove functions, unit-test & change `merge_object_detection_…
May 14, 2024
8014e88
Test box_non_max_merge
May 14, 2024
26bafec
Test box_non_max_merge, rename threshold,to __init__
May 15, 2024
d2d50fb
renamed bbox -> xyxy
May 15, 2024
2d740bd
fix: merge_object_detection_pair
May 15, 2024
145b5fe
Rename to batch_box_non_max_merge to box_non_max_merge_batch
May 15, 2024
6c40935
box_non_max_merge: use our functions to compute iou
May 15, 2024
53f345e
Minor renaming
May 15, 2024
0e2eec0
Revert np.bool comparisons with `is`
May 15, 2024
559ef90
Simplify box_non_max_merge
May 15, 2024
f8f3647
Removed suprplus NMM code for 20% speedup
May 15, 2024
9024396
Add npt.NDarray[x] types, remove resolution_wh default val
May 17, 2024
6fbca83
Address review comments, simplify merge
May 23, 2024
db1b473
fix(pre_commit): 🎨 auto format pre-commit hooks
pre-commit-ci[bot] May 23, 2024
0721bc2
Remove _set_at_index
May 23, 2024
530e1d0
Address comments
May 27, 2024
2ee9e08
Renamed to group_overlapping_boxes
May 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename to batch_box_non_max_merge to box_non_max_merge_batch
  • Loading branch information
Linas Kondrackis committed May 15, 2024
commit 145b5fe56c1b1daec6e8161fece90a5f23155c76
2 changes: 1 addition & 1 deletion supervision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
from supervision.detection.tools.polygon_zone import PolygonZone, PolygonZoneAnnotator
from supervision.detection.tools.smoother import DetectionsSmoother
from supervision.detection.utils import (
batch_box_non_max_merge,
box_iou_batch,
box_non_max_merge,
box_non_max_merge_batch,
box_non_max_suppression,
calculate_masks_centroids,
clip_boxes,
Expand Down
4 changes: 2 additions & 2 deletions supervision/detection/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

from supervision.config import CLASS_NAME_DATA_FIELD, ORIENTED_BOX_COORDINATES
from supervision.detection.utils import (
batch_box_non_max_merge,
box_iou_batch,
box_non_max_merge,
box_non_max_merge_batch,
box_non_max_suppression,
calculate_masks_centroids,
extract_ultralytics_masks,
Expand Down Expand Up @@ -1226,7 +1226,7 @@ def with_nmm(
self.class_id.reshape(-1, 1),
)
)
keep_to_merge_list = batch_box_non_max_merge(predictions, threshold)
keep_to_merge_list = box_non_max_merge_batch(predictions, threshold)

result = []
for keep_ind, merge_ind_list in keep_to_merge_list.items():
Expand Down
8 changes: 1 addition & 7 deletions supervision/detection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,12 @@ def box_non_max_merge(
y2 = predictions[:, 3]

scores = predictions[:, 4]

areas = (x2 - x1) * (y2 - y1)

order = scores.argsort()

keep = []

while len(order) > 0:
idx = order[-1]

keep.append(idx.tolist())

order = order[:-1]

if len(order) == 0:
Expand Down Expand Up @@ -353,7 +347,7 @@ def box_non_max_merge(
return keep_to_merge_list


def batch_box_non_max_merge(
def box_non_max_merge_batch(
predictions: np.ndarray, iou_threshold: float = 0.5
) -> Dict[int, List[int]]:
"""
Expand Down