anomalib.models.components.layers.sspcab

SSPCAB: Self-Supervised Predictive Convolutional Attention Block for reconstruction-based models.

Paper https://arxiv.org/abs/2111.09099

Module Contents

Classes

AttentionModule

Squeeze and excitation block that acts as the attention module in SSPCAB.

SSPCAB

SSPCAB block.

class anomalib.models.components.layers.sspcab.AttentionModule(in_channels: int, reduction_ratio: int = 8)[source]

Bases: torch.nn.Module

Squeeze and excitation block that acts as the attention module in SSPCAB.

Parameters
  • channels (int) – Number of input channels.

  • reduction_ratio (int) – Reduction ratio of the attention module.

forward(inputs: torch.Tensor) torch.Tensor[source]

Forward pass through the attention module.

class anomalib.models.components.layers.sspcab.SSPCAB(in_channels: int, kernel_size: int = 1, dilation: int = 1, reduction_ratio: int = 8)[source]

Bases: torch.nn.Module

SSPCAB block.

Parameters
  • in_channels (int) – Number of input channels.

  • kernel_size (int) – Size of the receptive fields of the masked convolution kernel.

  • dilation (int) – Dilation factor of the masked convolution kernel.

  • reduction_ratio (int) – Reduction ratio of the attention module.

forward(inputs: torch.Tensor) torch.Tensor[source]

Forward pass through the SSPCAB block.