Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Function contains unused argument (#1240)

Edgar Riba9be7b21e2d9b
diff --git a/kornia/augmentation/utils/helpers.py b/kornia/augmentation/utils/helpers.py
index 9ff6bf983..4910e0ba4 100644
--- a/kornia/augmentation/utils/helpers.py
+++ b/kornia/augmentation/utils/helpers.py
@@ -226,7 +226,6 @@ def _adapted_uniform(
low: Union[float, int, torch.Tensor],
high: Union[float, int, torch.Tensor],
same_on_batch: bool = False,
- epsilon: float = 1e-6,
) -> torch.Tensor:
r"""The uniform sampling function that accepts 'same_on_batch'.
diff --git a/kornia/feature/affine_shape.py b/kornia/feature/affine_shape.py
index f2f6c2624..6cce0eebb 100644
--- a/kornia/feature/affine_shape.py
+++ b/kornia/feature/affine_shape.py
@@ -95,8 +95,7 @@ class LAFAffineShapeEstimator(nn.Module):
def __init__(self, patch_size: int = 32, affine_shape_detector: Optional[nn.Module] = None) -> None:
super().__init__()
self.patch_size = patch_size
- self.affine_shape_detector = PatchAffineShapeEstimator(self.patch_size)
- return
+ self.affine_shape_detector = affine_shape_detector or PatchAffineShapeEstimator(self.patch_size)
def __repr__(self):
return (
diff --git a/kornia/filters/unsharp.py b/kornia/filters/unsharp.py
index 1464baee5..e9fcfa202 100644
--- a/kornia/filters/unsharp.py
+++ b/kornia/filters/unsharp.py
@@ -30,7 +30,7 @@ def unsharp_mask(
>>> output.shape
torch.Size([2, 4, 5, 5])
"""
- data_blur: torch.Tensor = gaussian_blur2d(input, kernel_size, sigma)
+ data_blur: torch.Tensor = gaussian_blur2d(input, kernel_size, sigma, border_type)
data_sharpened: torch.Tensor = input + (input - data_blur)
return data_sharpened
diff --git a/kornia/geometry/subpix/spatial_soft_argmax.py b/kornia/geometry/subpix/spatial_soft_argmax.py
index 73d34355e..029f1d0f7 100644
--- a/kornia/geometry/subpix/spatial_soft_argmax.py
+++ b/kornia/geometry/subpix/spatial_soft_argmax.py
@@ -503,7 +503,6 @@ def spatial_soft_argmax2d(
input: torch.Tensor,
temperature: torch.Tensor = torch.tensor(1.0),
normalized_coordinates: bool = True,
- eps: float = 1e-8,
) -> torch.Tensor:
r"""Function that computes the Spatial Soft-Argmax 2D of a given input heatmap.
@@ -512,7 +511,6 @@ def spatial_soft_argmax2d(
temperature: factor to apply to input.
normalized_coordinates: whether to return the coordinates normalized in the range of :math:`[-1, 1]`.
Otherwise, it will return the coordinates in the range of the input shape.
- eps: small value to avoid zero division.
Returns:
the index of the maximum 2d coordinates of the give map :math:`(B, N, 2)`.
@@ -538,12 +536,11 @@ class SpatialSoftArgmax2d(nn.Module):
"""
def __init__(
- self, temperature: torch.Tensor = torch.tensor(1.0), normalized_coordinates: bool = True, eps: float = 1e-8
+ self, temperature: torch.Tensor = torch.tensor(1.0), normalized_coordinates: bool = True
) -> None:
super().__init__()
self.temperature: torch.Tensor = temperature
self.normalized_coordinates: bool = normalized_coordinates
- self.eps: float = eps
def __repr__(self) -> str:
return (
@@ -553,14 +550,11 @@ class SpatialSoftArgmax2d(nn.Module):
+ ', '
+ 'normalized_coordinates='
+ str(self.normalized_coordinates)
- + ', '
- + 'eps='
- + str(self.eps)
+ ')'
)
- def forward(self, input: torch.Tensor) -> torch.Tensor: # type: ignore
- return spatial_soft_argmax2d(input, self.temperature, self.normalized_coordinates, self.eps)
+ def forward(self, input: torch.Tensor) -> torch.Tensor:
+ return spatial_soft_argmax2d(input, self.temperature, self.normalized_coordinates)
def conv_quad_interp3d(
diff --git a/kornia/utils/draw.py b/kornia/utils/draw.py
index 66630a754..c9ec308b4 100644
--- a/kornia/utils/draw.py
+++ b/kornia/utils/draw.py
@@ -2,13 +2,14 @@ from typing import Optional
import torch
+# TODO: implement width of the line
+
def draw_rectangle(
image: torch.Tensor,
rectangle: torch.Tensor,
color: Optional[torch.Tensor] = None,
fill: Optional[bool] = None,
- width: int = 1,
) -> torch.Tensor:
r"""Draws N rectangles on a batch of image tensors.
@@ -20,7 +21,7 @@ def draw_rectangle(
color: a size 1, size 3, BxNx1, or BxNx3 tensor.
If C is 3, and color is 1 channel it will be broadcasted.
fill: is a flag used to fill the boxes with color if True.
- width: The line width (Not implemented yet).
+
Returns:
This operation modifies image inplace but also returns the drawn tensor for
convenience with same shape the of the input BxCxHxW.