π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Remove unused preprocess_boxes helper (#4321)
Pradeepbeleri1ba5b7c4afc8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a186408ac..c8142844b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -158,6 +158,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0in-tree MPS workarounds stay. (#4202)### Breaking changes+* Removed the unused `preprocess_boxes` helper, which had no public export or caller. (#4181, #4321)* `kornia_rs>=0.1.14` is required; the floor used to be 0.1.9. kornia_rs 0.1.11 relocated its image I/Oand 0.1.12/0.1.13 lack the libjpeg-turbo reader, so no single call site works across 0.1.9-0.1.14;diff --git a/kornia/augmentation/utils/helpers.py b/kornia/augmentation/utils/helpers.pyindex d08afe22c..760da8407 100644--- a/kornia/augmentation/utils/helpers.py+++ b/kornia/augmentation/utils/helpers.py@@ -22,7 +22,6 @@ import torchfrom torch.distributions import Beta, Uniformfrom kornia.core.utils import _extract_device_dtype-from kornia.geometry.boxes import Boxesfrom kornia.geometry.keypoints import Keypoints@@ -427,50 +426,6 @@ def override_parameters(return out-def preprocess_boxes(input: Union[torch.Tensor, Boxes], mode: str = "vertices_plus") -> Boxes:- r"""Preprocess input boxes.-- Args:- input: 2D boxes, shape of :math:`(N, 4, 2)`, :math:`(B, N, 4, 2)` or a list of :math:`(N, 4, 2)`.- See below for more details.- mode: The format in which the boxes are provided.-- * 'xyxy': boxes are assumed to be in the format ``xmin, ymin, xmax, ymax`` where- ``width = xmax - xmin``- and ``height = ymax - ymin``. With shape :math:`(N, 4)`, :math:`(B, N, 4)`.- * 'xyxy_plus': similar to 'xyxy' mode but where box width and length are defined as- ``width = xmax - xmin + 1`` and ``height = ymax - ymin + 1``.- With shape :math:`(N, 4)`, :math:`(B, N, 4)`.- * 'xywh': boxes are assumed to be in the format ``xmin, ymin, width, height`` where- ``width = xmax - xmin`` and ``height = ymax - ymin``. With shape :math:`(N, 4)`, :math:`(B, N, 4)`.- * 'vertices': boxes are defined by their vertices points in the following ``clockwise`` order:- *top-left, top-right, bottom-right, bottom-left*. Vertices coordinates are in (x,y) order. Finally,- box width and height are defined as ``width = xmax - xmin`` and ``height = ymax - ymin``.- With shape :math:`(N, 4, 2)` or :math:`(B, N, 4, 2)`.- * 'vertices_plus': similar to 'vertices' mode but where box width and length are defined as- ``width = xmax - xmin + 1`` and ``height = ymax - ymin + 1``. ymin + 1``.- With shape :math:`(N, 4, 2)` or :math:`(B, N, 4, 2)`.-- Note:- **2D boxes format** is defined as a floating data type torch.Tensor of shape ``Nx4x2`` or ``BxNx4x2``- where each box is a `quadrilateral <https://en.wikipedia.org/wiki/Quadrilateral>`_ defined by- it's 4 vertices- coordinates (A, B, C, D). Coordinates must be in ``x, y`` order. The height and width of a box is defined as- ``width = xmax - xmin + 1`` and ``height = ymax - ymin + 1``. Examples of- `quadrilaterals <https://en.wikipedia.org/wiki/Quadrilateral>`_ are rectangles, rhombus and trapezoids.-- """- # TODO: We may allow list here.- # input is BxNx4x2 or Boxes.- if isinstance(input, torch.Tensor):- if not (len(input.shape) == 4 and input.shape[2:] == torch.Size([4, 2])):- raise RuntimeError(f"Only BxNx4x2 torch.Tensor is supported. Got {input.shape}.")- input = Boxes.from_tensor(input, mode=mode)- if not isinstance(input, Boxes):- raise RuntimeError(f"Expect `Boxes` type. Got {type(input)}.")- return input--def preprocess_keypoints(input: Union[torch.Tensor, Keypoints]) -> Keypoints:"""Preprocess input keypoints."""# TODO: We may allow list here.