π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Fix unused variable found 2/n (#1252)
Edgar Riba255a01a4778b
diff --git a/kornia/augmentation/augmentation.py b/kornia/augmentation/augmentation.pyindex 37a30c3ea..585af67af 100644--- a/kornia/augmentation/augmentation.py+++ b/kornia/augmentation/augmentation.py@@ -2059,7 +2059,7 @@ class RandomFisheye(GeometricAugmentationBase2D):self, input: torch.Tensor, params: Dict[str, torch.Tensor], transform: Optional[torch.Tensor] = None) -> torch.Tensor:# create the initial sampling fields- B, C, H, W = input.shape+ B, _, H, W = input.shapegrid = create_meshgrid(H, W, normalized_coordinates=True)field_x = grid[..., 0].to(input) # 1xHxWfield_y = grid[..., 1].to(input) # 1xHxWdiff --git a/kornia/feature/laf.py b/kornia/feature/laf.pyindex 63c73169f..6afaf51e9 100644--- a/kornia/feature/laf.py+++ b/kornia/feature/laf.py@@ -375,7 +375,7 @@ def normalize_laf(LAF: torch.Tensor, images: torch.Tensor) -> torch.Tensor:- Output: :math:`(B, N, 2, 3)`"""raise_error_if_laf_is_not_valid(LAF)- n, _, h, w = images.size()+ _, _, h, w = images.size()wf: float = float(w)hf: float = float(h)min_size = min(hf, wf)@@ -398,7 +398,7 @@ def generate_patch_grid_from_normalized_LAF(img: torch.Tensor, LAF: torch.Tensor"""raise_error_if_laf_is_not_valid(LAF)B, N, _, _ = LAF.size()- num, ch, h, w = img.size()+ _, ch, h, w = img.size()# norm, then renorm is needed for allowing detection on one resolution# and extraction at arbitrary other@@ -512,7 +512,7 @@ def laf_is_inside_image(laf: torch.Tensor, images: torch.Tensor, border: int = 0mask with shape :math:`(B, N)`."""raise_error_if_laf_is_not_valid(laf)- n, _, h, w = images.size()+ _, _, h, w = images.size()pts: torch.Tensor = laf_to_boundary_points(laf, 12)good_lafs_mask: torch.Tensor = ((pts[..., 0] >= border) * (pts[..., 0] <= w - border) * (pts[..., 1] >= border) * (pts[..., 1] <= h - border)diff --git a/kornia/feature/orientation.py b/kornia/feature/orientation.pyindex 35de45487..d593bcb38 100644--- a/kornia/feature/orientation.py+++ b/kornia/feature/orientation.py@@ -79,7 +79,7 @@ class PatchDominantGradientOrientation(nn.Module):raise TypeError(f"Input type is not a torch.Tensor. Got {type(patch)}")if not len(patch.shape) == 4:raise ValueError(f"Invalid input shape, we expect Bx1xHxW. Got: {patch.shape}")- B, CH, W, H = patch.size()+ _, CH, W, H = patch.size()if (W != self.patch_size) or (H != self.patch_size) or (CH != 1):raise TypeError("input shape should be must be [Bx1x{}x{}]. "diff --git a/kornia/geometry/depth.py b/kornia/geometry/depth.pyindex daa978400..7bcd747b4 100644--- a/kornia/geometry/depth.py+++ b/kornia/geometry/depth.py@@ -287,7 +287,7 @@ class DepthWarper(nn.Module):raise ValueError("Input depth_src has to be in the shape of " "Bx1xHxW. Got {}".format(depth_src.shape))# unpack depth attributes- batch_size, _, height, width = depth_src.shape+ batch_size, _, _, _ = depth_src.shapedevice: torch.device = depth_src.devicedtype: torch.dtype = depth_src.dtypediff --git a/kornia/geometry/epipolar/essential.py b/kornia/geometry/epipolar/essential.pyindex 24bdb3b50..3b3ed44dc 100644--- a/kornia/geometry/epipolar/essential.py+++ b/kornia/geometry/epipolar/essential.py@@ -50,7 +50,7 @@ def decompose_essential_matrix(E_mat: torch.Tensor) -> Tuple[torch.Tensor, torchraise AssertionError(E_mat.shape)# decompose matrix by its singular values- U, S, V = torch.svd(E_mat)+ U, _, V = torch.svd(E_mat)Vt = V.transpose(-2, -1)mask = torch.ones_like(E_mat)diff --git a/kornia/geometry/transform/pyramid.py b/kornia/geometry/transform/pyramid.pyindex d8edf3341..b27f9c663 100644--- a/kornia/geometry/transform/pyramid.py+++ b/kornia/geometry/transform/pyramid.py@@ -184,7 +184,7 @@ class ScalePyramid(nn.Module):return cur_level, cur_sigma, pixel_distancedef forward(self, x: torch.Tensor) -> Tuple[List, List, List]: # type: ignore- bs, ch, _, _ = x.size()+ bs, _, _, _ = x.size()cur_level, cur_sigma, pixel_distance = self.get_first_level(x)sigmas = [cur_sigma * torch.ones(bs, self.n_levels + self.extra_levels).to(x.device).to(x.dtype)]diff --git a/kornia/geometry/warp/depth_warper.py b/kornia/geometry/warp/depth_warper.pyindex ec9d8cf19..cd1efbf17 100644--- a/kornia/geometry/warp/depth_warper.py+++ b/kornia/geometry/warp/depth_warper.py@@ -46,7 +46,7 @@ def depth_warp(width: int,align_corners: bool = True,):- __doc__ = _depth_warp.__doc__+ __doc__ = _depth_warp.__doc__ # skipcq: PYL-W0612warnings.warn("`depth_warp` is deprecated and will be removed > 0.6.0. Please use `kornia.geometry.depth_warp instead.`",DeprecationWarning,diff --git a/test/augmentation/test_container.py b/test/augmentation/test_container.pyindex dfe30c7b8..7d1d965a7 100644--- a/test/augmentation/test_container.py+++ b/test/augmentation/test_container.py@@ -95,7 +95,7 @@ class TestVideoSequential:input = torch.randn(2, 3, 1, 5, 6, device=device, dtype=dtype).repeat(1, 1, 4, 1, 1)output = aug_list(input)if aug_list.return_label:- output, label = output+ output, _ = outputassert (output[:, :, 0] == output[:, :, 1]).all()assert (output[:, :, 1] == output[:, :, 2]).all()assert (output[:, :, 2] == output[:, :, 3]).all()@@ -103,7 +103,7 @@ class TestVideoSequential:input = torch.randn(2, 1, 3, 5, 6, device=device, dtype=dtype).repeat(1, 4, 1, 1, 1)output = aug_list(input)if aug_list.return_label:- output, label = output+ output, _ = outputassert (output[:, 0] == output[:, 1]).all()assert (output[:, 1] == output[:, 2]).all()assert (output[:, 2] == output[:, 3]).all()