From 7fa7907219a683b98167f85758dbde6f8faf6f8b Mon Sep 17 00:00:00 2001 From: Eric Criteser Date: Thu, 11 Jul 2024 14:42:13 -0500 Subject: [PATCH] Run pre-commit and fix issues --- supervision/detection/tools/inference_slicer.py | 6 ++++-- supervision/detection/utils.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index 00023ec3..7208d3ce 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -28,8 +28,10 @@ def move_detections( (sv.Detections) repositioned Detections object. """ detections.xyxy = move_boxes(xyxy=detections.xyxy, offset=offset) - if 'xyxyxyxy' in detections: - detections.xyxyxyxy = move_obb_boxes(xyxyxyxy = detections.xyxyxyxy, offset = offset) + if "xyxyxyxy" in detections: + detections.xyxyxyxy = move_obb_boxes( + xyxyxyxy=detections.xyxyxyxy, offset=offset + ) if detections.mask is not None: if resolution_wh is None: raise ValueError( diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 5082afb3..5f38905a 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -595,6 +595,7 @@ def move_boxes( """ return xyxy + np.hstack([offset, offset]) + def move_obb_boxes(xyxyxyxy, offset): """ Parameters: @@ -604,7 +605,7 @@ def move_obb_boxes(xyxyxyxy, offset): is `[dx, dy]`. Returns: - npt.NDArray[np.float64]: Repositioned oriented bounding boxes. + npt.NDArray[np.float64]: Repositioned oriented bounding boxes. Examples: ```python @@ -623,6 +624,7 @@ def move_obb_boxes(xyxyxyxy, offset): return xyxyxyxy + np.hstack([offset, offset, offset, offset]) + def move_masks( masks: npt.NDArray[np.bool_], offset: npt.NDArray[np.int32],