🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Fix LightGlue normalize_keypoints with torch.Size input (#3075)
Dávid Komorowicz5985885d6636
diff --git a/kornia/feature/lightglue.py b/kornia/feature/lightglue.pyindex 0454c900d..b7a01be41 100644--- a/kornia/feature/lightglue.py+++ b/kornia/feature/lightglue.py@@ -45,7 +45,7 @@ def math_clamp(x, min_, max_): # type: ignore@custom_fwd(cast_inputs=torch.float32)def normalize_keypoints(kpts: Tensor, size: Tensor) -> Tensor:if isinstance(size, torch.Size):- size = Tensor(size)[None]+ size = torch.tensor(size)[None]shift = size.float().to(kpts) / 2scale = size.max(1).values.float().to(kpts) / 2kpts = (kpts - shift[:, None]) / scale[:, None, None]