chore: import box_iou to supervision/__init__.py

This commit is contained in:
soumik12345 2025-07-14 17:03:23 +05:30
parent 8e437f89fa
commit 18cd73f55a
2 changed files with 7 additions and 5 deletions

View File

@ -58,6 +58,7 @@ 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 (
box_iou,
box_iou_batch,
box_iou_batch_with_jaccard,
calculate_masks_centroids,
@ -181,6 +182,7 @@ __all__ = [
"VertexLabelAnnotator",
"VideoInfo",
"VideoSink",
"box_iou",
"box_iou_batch",
"box_iou_batch_with_jaccard",
"box_non_max_merge",

View File

@ -76,13 +76,13 @@ def box_iou(
Examples:
```python
import numpy as np
from supervision.detection.utils import box_iou
import supervision as sv
box_true = np.array([100, 100, 200, 200])
box_detection = np.array([150, 150, 250, 250])
box_iou(box_true=box_true, box_detection=box_detection)
# 0.14285714285714285
sv.box_iou(box_true=box_true, box_detection=box_detection)
# 0.14285814285714285
```
"""
box_true = np.array(box_true)
@ -133,7 +133,7 @@ def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.nda
Examples:
```python
import numpy as np
from supervision.detection.utils import box_iou_batch
import supervision as sv
boxes_true = np.array([
[100, 100, 200, 200],
@ -144,7 +144,7 @@ def box_iou_batch(boxes_true: np.ndarray, boxes_detection: np.ndarray) -> np.nda
[320, 320, 420, 420]
])
box_iou_batch(boxes_true=boxes_true, boxes_detection=boxes_detection)
sv.box_iou_batch(boxes_true=boxes_true, boxes_detection=boxes_detection)
# array([
# [0.14285714, 0. ],
# [0. , 0.47058824]