class_docstr: Callback that normalizes the image-level and pixel-level anomaly scores using min-max normalization.
class_docstr_tok: ["Callback","that","normalizes","the","image-level","and","pixel-level","anomaly","scores","using","min-max","normalization","."]
docstr: Adds min_max metrics to normalization metrics.
docstr_tok: ["Adds","min_max","metrics","to","normalization","metrics","."]
code: def setup(
      self,
      trainer: pl.Trainer,
      pl_module: AnomalyModule,
      stage: str | None = None,
  ) -> None:
      """Adds min_max metrics to normalization metrics."""
      del trainer, stage  # These variables are not used.
  
      if not hasattr(pl_module, "normalization_metrics"):
          pl_module.normalization_metrics = MinMax().cpu()
      elif not isinstance(pl_module.normalization_metrics, MinMax):
          raise AttributeError(
              f"Expected normalization_metrics to be of type MinMax, got {type(pl_module.normalization_metrics)}"
          )
  
file_path: anomalib/src/anomalib/utils/callbacks/min_max_normalization.py
imports: from __future__ import annotations
  from typing import Any
  import pytorch_lightning
  import torch
  from pytorch_lightning import Callback
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from anomalib.models.components import AnomalyModule
  from anomalib.post_processing.normalization.min_max import normalize
  from anomalib.utils.metrics import MinMax
label_desc: Use image node_id 1 for calling the MinMaxNormalizationCallback obj's underlying member method code with example usage: obj.setup(trainer, pl_module, stage) without return types