anomalib.utils.callbacks.min_max_normalization

Anomaly Score Normalization Callback that uses min-max normalization.

Module Contents

Classes

MinMaxNormalizationCallback

Callback that normalizes the image-level and pixel-level anomaly scores using min-max normalization.

class anomalib.utils.callbacks.min_max_normalization.MinMaxNormalizationCallback[source]

Bases: pytorch_lightning.Callback

Callback that normalizes the image-level and pixel-level anomaly scores using min-max normalization.

on_test_start(_trainer: pytorch_lightning.Trainer, pl_module: anomalib.models.components.AnomalyModule) None[source]

Called when the test begins.

on_validation_batch_end(_trainer: pytorch_lightning.Trainer, pl_module: anomalib.models.components.AnomalyModule, outputs: pytorch_lightning.utilities.types.STEP_OUTPUT, _batch: Any, _batch_idx: int, _dataloader_idx: int) None[source]

Called when the validation batch ends, update the min and max observed values.

on_test_batch_end(_trainer: pytorch_lightning.Trainer, pl_module: anomalib.models.components.AnomalyModule, outputs: pytorch_lightning.utilities.types.STEP_OUTPUT, _batch: Any, _batch_idx: int, _dataloader_idx: int) None[source]

Called when the test batch ends, normalizes the predicted scores and anomaly maps.

on_predict_batch_end(_trainer: pytorch_lightning.Trainer, pl_module: anomalib.models.components.AnomalyModule, outputs: Dict, _batch: Any, _batch_idx: int, _dataloader_idx: int) None[source]

Called when the predict batch ends, normalizes the predicted scores and anomaly maps.

static _normalize_batch(outputs, pl_module)[source]

Normalize a batch of predictions.