Rename to batch_box_non_max_merge to box_non_max_merge_batch

This commit is contained in:
Linas Kondrackis
2024-05-15 10:46:56 +03:00
parent 2d740bdcb6
commit 145b5fe56c
3 changed files with 4 additions and 10 deletions
+1 -1
View File
@@ -43,9 +43,9 @@ from supervision.detection.tools.json_sink import JSONSink
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,
+2 -2
View File
@@ -8,9 +8,9 @@ import numpy as np
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,
@@ -1226,7 +1226,7 @@ class Detections:
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():
+1 -7
View File
@@ -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:
@@ -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]]:
"""