From c9d4f2b82e9a65ee6b9717d9cec04548c7701c5d Mon Sep 17 00:00:00 2001 From: Eric Criteser Date: Sat, 13 Jul 2024 08:18:47 -0500 Subject: [PATCH] commit under new branch --- supervision/detection/tools/inference_slicer.py | 6 +++--- supervision/detection/utils.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/supervision/detection/tools/inference_slicer.py b/supervision/detection/tools/inference_slicer.py index 2372dc51..277854f9 100644 --- a/supervision/detection/tools/inference_slicer.py +++ b/supervision/detection/tools/inference_slicer.py @@ -28,9 +28,9 @@ def move_detections( (sv.Detections) repositioned Detections object. """ detections.xyxy = move_boxes(xyxy=detections.xyxy, offset=offset) - if "xyxyxyxy" in detections.data: - detections.data["xyxyxyxy"] = move_obb_boxes( - xyxyxyxy=detections.data["xyxyxyxy"], offset=offset + if "ORIENTED_BOX_COORDINATES" in detections.data: + detections.data["ORIENTED_BOX_COORDINATES"] = move_obb_boxes( + xyss=detections.data["ORIENTED_BOX_COORDINATES"], offset=offset ) if detections.mask is not None: if resolution_wh is None: diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 0349c4b6..1d984ceb 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -596,7 +596,8 @@ def move_boxes( return xyxy + np.hstack([offset, offset]) -def move_obb_boxes(xyxyxyxy, offset): +def move_obb_boxes(xyss: npt.NDArray[np.float64], offset: npt.NDArray[np.int32] + ) -> npt.NDArray[np.float64]: """ Parameters: xyxyxyxy (npt.NDArray[np.float64]): An array of shape `(n, 4, 2)` containing the @@ -619,7 +620,7 @@ def move_obb_boxes(xyxyxyxy, offset): [40., 40.]]]) offset = np.array([5, 10]) - sv.move_obb_boxes(xyxyxyxy=xyxyxyxy, offset=offset) + sv.move_obb_boxes(xyss, offset=offset) #[[[15., 20.], #[25., 30.], #[35., 40.], @@ -628,7 +629,7 @@ def move_obb_boxes(xyxyxyxy, offset): """ return [ xys + np.hstack([offset, offset, offset, offset]).reshape(xys.shape) - for xys in xyxyxyxy + for xys in xyss ]