Skip to content

Commit

Permalink
fix(pre_commit): 🎨 auto format pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Dec 3, 2024
1 parent ab35683 commit bf5a92c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions supervision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
pad_boxes,
polygon_to_mask,
polygon_to_xyxy,
resolve_letterbox,
scale_boxes,
xcycwh_to_xyxy,
xywh_to_xyxy,
resolve_letterbox,
)
from supervision.draw.color import Color, ColorPalette
from supervision.draw.utils import (
Expand Down Expand Up @@ -218,9 +218,9 @@
"polygon_to_xyxy",
"process_video",
"resize_image",
"resolve_letterbox",
"rle_to_mask",
"scale_boxes",
"resolve_letterbox",
"scale_image",
"xcycwh_to_xyxy",
"xywh_to_xyxy",
Expand Down
10 changes: 7 additions & 3 deletions supervision/detection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,11 @@ def scale_boxes(
return np.concatenate((centers - new_sizes / 2, centers + new_sizes / 2), axis=1)


def resolve_letterbox(xyxy: npt.NDArray[np.float64], letterbox_wh: Tuple[int, int], resolution_wh: Tuple[int, int]) -> npt.NDArray[np.float64]:
def resolve_letterbox(
xyxy: npt.NDArray[np.float64],
letterbox_wh: Tuple[int, int],
resolution_wh: Tuple[int, int],
) -> npt.NDArray[np.float64]:
"""
Resolves the bounding box coordinates from letterbox format to the required resolution.
Args:
Expand Down Expand Up @@ -790,7 +794,7 @@ def resolve_letterbox(xyxy: npt.NDArray[np.float64], letterbox_wh: Tuple[int, in

scale = input_w / width_new

padding_top = (letterbox_h - height_new) // 2
padding_top = (letterbox_h - height_new) // 2
padding_left = (letterbox_w - width_new) // 2

boxes = xyxy.copy()
Expand All @@ -801,7 +805,7 @@ def resolve_letterbox(xyxy: npt.NDArray[np.float64], letterbox_wh: Tuple[int, in
boxes[:, [1, 3]] *= scale

return boxes


def calculate_masks_centroids(masks: np.ndarray) -> np.ndarray:
"""
Expand Down

0 comments on commit bf5a92c

Please sign in to comment.