π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
fix linter issues
edgarriba49c1aac1c62f
diff --git a/kornia/contrib/spatial_soft_argmax2d.py b/kornia/contrib/spatial_soft_argmax2d.pyindex 7ac9c72df..e6daea474 100644--- a/kornia/contrib/spatial_soft_argmax2d.py+++ b/kornia/contrib/spatial_soft_argmax2d.py@@ -70,6 +70,7 @@ class SpatialSoftArgmax2d(nn.Module):See :class:`~kornia.contrib.spatial_soft_argmax2d` for details."""+def __init__(self,temperature: torch.Tensor = torch.tensor(1.0),normalized_coordinates: bool = True,diff --git a/kornia/geometry/camera/perspective.py b/kornia/geometry/camera/perspective.pyindex fd8e3ca1a..60430436a 100644--- a/kornia/geometry/camera/perspective.py+++ b/kornia/geometry/camera/perspective.py@@ -25,7 +25,7 @@ def project_points("""if not torch.is_tensor(point_3d):raise TypeError("Input point_3d type is not a torch.Tensor. Got {}"- .format(type(points_3d)))+ .format(type(point_3d)))if not torch.is_tensor(camera_matrix):raise TypeError("Input camera_matrix type is not a torch.Tensor. Got {}".format(type(camera_matrix)))@@ -35,7 +35,8 @@ def project_points(raise ValueError("Input points_3d must be in the shape of (*, 3)."" Got {}".format(point_3d.shape))if not camera_matrix.shape[-2:] == (3, 3):- raise ValueError("Input camera_matrix must be in the shape of (*, 3, 3).")+ raise ValueError(+ "Input camera_matrix must be in the shape of (*, 3, 3).")# projection eq. [u, v, w]' = K * [x y z 1]'# project back using depth dividing in a safe wayxy_coords: torch.Tensor = convert_points_from_homogeneous(point_3d)@@ -79,7 +80,7 @@ def unproject_points("""if not torch.is_tensor(point_2d):raise TypeError("Input point_2d type is not a torch.Tensor. Got {}"- .format(type(points_2d)))+ .format(type(point_2d)))if not torch.is_tensor(depth):raise TypeError("Input depth type is not a torch.Tensor. Got {}".format(type(depth)))@@ -95,7 +96,8 @@ def unproject_points(raise ValueError("Input depth must be in the shape of (*, 1)."" Got {}".format(depth.shape))if not camera_matrix.shape[-2:] == (3, 3):- raise ValueError("Input camera_matrix must be in the shape of (*, 3, 3).")+ raise ValueError(+ "Input camera_matrix must be in the shape of (*, 3, 3).")# projection eq. K_inv * [u v 1]'# inverse the camera matrixcamera_matrix_inv: torch.Tensor = torch.inverse(camera_matrix)diff --git a/test/geometry/test_perspective.py b/test/geometry/test_perspective.pyindex f80956755..12c6d21f1 100644--- a/test/geometry/test_perspective.py+++ b/test/geometry/test_perspective.py@@ -138,7 +138,8 @@ class TestUnprojectPoints:def test_jit(self):@torch.jit.scriptdef op_script(points_2d, depth, camera_matrix):- return kornia.unproject_points(points_2d, depth, camera_matrix, False)+ return kornia.unproject_points(+ points_2d, depth, camera_matrix, False)points_2d = torch.zeros(1, 2)depth = torch.ones(1, 1)