From 02a3cdd0e7f0049525b3ff52cb17e0d88c81afc9 Mon Sep 17 00:00:00 2001 From: Flippchen <91947480+Flippchen@users.noreply.github.com> Date: Fri, 28 Jul 2023 14:52:36 +0200 Subject: [PATCH] Correct docstring and delete unused code in `scale_image` function (#4001) --- ultralytics/utils/ops.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ultralytics/utils/ops.py b/ultralytics/utils/ops.py index 38f4eb0..1e18258 100644 --- a/ultralytics/utils/ops.py +++ b/ultralytics/utils/ops.py @@ -321,7 +321,7 @@ def scale_image(masks, im0_shape, ratio_pad=None): Takes a mask, and resizes it to the original image size Args: - masks (torch.Tensor): resized and padded masks/images, [h, w, num]/[h, w, 3]. + masks (np.ndarray): resized and padded masks/images, [h, w, num]/[h, w, 3]. im0_shape (tuple): the original image shape ratio_pad (tuple): the ratio of the padding to the original image. @@ -344,9 +344,6 @@ def scale_image(masks, im0_shape, ratio_pad=None): if len(masks.shape) < 2: raise ValueError(f'"len of masks shape" should be 2 or 3, but got {len(masks.shape)}') masks = masks[top:bottom, left:right] - # masks = masks.permute(2, 0, 1).contiguous() - # masks = F.interpolate(masks[None], im0_shape[:2], mode='bilinear', align_corners=False)[0] - # masks = masks.permute(1, 2, 0).contiguous() masks = cv2.resize(masks, (im0_shape[1], im0_shape[0])) if len(masks.shape) == 2: masks = masks[:, :, None]