diff --git a/tests/test_python.py b/tests/test_python.py index 2168f7dbfc..f5fb0a7333 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -353,7 +353,7 @@ def test_utils_ops(): make_divisible(17, torch.tensor([8])) - boxes = torch.rand(10, 4) # xywhn + boxes = torch.rand(10, 4) # xywh torch.allclose(boxes, xyxy2xywh(xywh2xyxy(boxes))) torch.allclose(boxes, xyxy2xywhn(xywhn2xyxy(boxes))) torch.allclose(boxes, ltwh2xywh(xywh2ltwh(boxes))) diff --git a/ultralytics/utils/ops.py b/ultralytics/utils/ops.py index 9afc3eda65..ef741ad53b 100644 --- a/ultralytics/utils/ops.py +++ b/ultralytics/utils/ops.py @@ -473,7 +473,7 @@ def xyxyxyxy2xywhr(corners): (numpy.ndarray | torch.Tensor): Converted data in [cx, cy, w, h, rotation] format of shape (n, 5). """ is_numpy = isinstance(corners, np.ndarray) - atan2, sqrt = (torch.atan2, torch.sqrt) if is_numpy else (np.arctan2, np.sqrt) + atan2, sqrt = (np.arctan2, np.sqrt) if is_numpy else (torch.atan2, torch.sqrt) x1, y1, x2, y2, x3, y3, x4, y4 = corners.T cx = (x1 + x3) / 2 @@ -501,7 +501,7 @@ def xywhr2xyxyxyxy(center): (numpy.ndarray | torch.Tensor): Converted corner points of shape (n, 8). """ is_numpy = isinstance(center, np.ndarray) - cos, sin = (torch.cos, torch.sin) if is_numpy else (np.cos, np.sin) + cos, sin = (np.cos, np.sin) if is_numpy else (torch.cos, torch.sin) cx, cy, w, h, rotation = center.T rotation *= math.pi / 180.0 # degrees to radians