anomalib.models.reverse_distillation.anomaly_map

Compute Anomaly map.

Module Contents

Classes

AnomalyMapGenerator

Generate Anomaly Heatmap.

class anomalib.models.reverse_distillation.anomaly_map.AnomalyMapGenerator(image_size: Union[omegaconf.ListConfig, Tuple], sigma: int = 4, mode: str = 'multiply')[source]

Generate Anomaly Heatmap.

Parameters
  • image_size (Union[ListConfig, Tuple]) – Size of original image used for upscaling the anomaly map.

  • sigma (int) – Standard deviation of the gaussian kernel used to smooth anomaly map.

  • mode (str, optional) – Operation used to generate anomaly map. Options are add and multiply. Defaults to “multiply”.

Raises

ValueError – In case modes other than multiply and add are passed.

__call__(student_features: List[torch.Tensor], teacher_features: List[torch.Tensor]) torch.Tensor[source]

Computes anomaly map given encoder and decoder features.

Parameters
  • student_features (List[Tensor]) – List of encoder features

  • teacher_features (List[Tensor]) – List of decoder features

Returns

Anomaly maps of length batch.

Return type

Tensor