class_docstr: PaDiM: a Patch Distribution Modeling Framework for Anomaly Detection and Localization.
  
  Args:
      layers (list[str]): Layers to extract features from the backbone CNN
      input_size (tuple[int, int]): Size of the model input.
      backbone (str): Backbone CNN network
      pre_trained (bool, optional): Boolean to check whether to use a pre_trained backbone.
      n_features (int, optional): Number of features to retain in the dimension reduction step.
                              Default values from the paper are available for: resnet18 (100), wide_resnet50_2 (550).
class_docstr_tok: ["PaDiM",":","a","Patch","Distribution","Modeling","Framework","for","Anomaly","Detection","and","Localization",".","Args",":","layers","(","list","[","str","]",")",":","Layers","to","extract","features","from","the","backbone","CNN","input_size","(","tuple","[","int",",","int","]",")",":","Size","of","the","model","input",".","backbone","(","str",")",":","Backbone","CNN","network","pre_trained","(","bool",",","optional",")",":","Boolean","to","check","whether","to","use","a","pre_trained","backbone",".","n_features","(","int",",","optional",")",":","Number","of","features","to","retain","in","the","dimension","reduction","step",".","Default","values","from","the","paper","are","available","for",":","resnet18","(","100",")",",","wide_resnet50_2","(","550",")","."]
docstr: Fit a Gaussian to the embedding collected from the training set.
docstr_tok: ["Fit","a","Gaussian","to","the","embedding","collected","from","the","training","set","."]
code: def on_validation_start(self) -> None:
      """Fit a Gaussian to the embedding collected from the training set."""
      # NOTE: Previous anomalib versions fit Gaussian at the end of the epoch.
      #   This is not possible anymore with PyTorch Lightning v1.4.0 since validation
      #   is run within train epoch.
      logger.info(
          "Aggregating the embedding extracted from the training set."
      )
      embeddings = torch.vstack(self.embeddings)
  
      logger.info(
          "Fitting a Gaussian to the embedding collected from the training set."
      )
      self.stats = self.model.gaussian.fit(embeddings)
  
file_path: anomalib/src/anomalib/models/padim/lightning_model.py
imports: from __future__ import annotations
  import logging
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from torch import Tensor
  from anomalib.models.components import AnomalyModule
  from anomalib.models.padim.torch_model import PadimModel
label_desc: Use image node_id 4 for calling the Padim obj's underlying member method code with example usage: obj.on_validation_start() without return types