anomalib.models.components.filters

Implements filters used by models.

Submodules

Package Contents

Classes

GaussianBlur2d

Compute GaussianBlur in 2d.

class anomalib.models.components.filters.GaussianBlur2d(kernel_size: Union[Tuple[int, int], int], sigma: Union[Tuple[float, float], float], channels: int, normalize: bool = True, border_type: str = 'reflect', padding: str = 'same')[source]

Bases: torch.nn.Module

Compute GaussianBlur in 2d.

Makes use of kornia functions, but most notably the kernel is not computed during the forward pass, and does not depend on the input size. As a caveat, the number of channels that are expected have to be provided during initialization.

forward(input_tensor: torch.Tensor) torch.Tensor

Blur the input with the computed Gaussian.

Parameters

input_tensor (Tensor) – Input tensor to be blurred.

Returns

Blurred output tensor.

Return type

Tensor