class_docstr: Region Based Anomaly Detection With Real-Time Training and Analysis.
  
  Args:
      roi_stage (RoiStage, optional): Processing stage from which rois are extracted.
      roi_score_threshold (float, optional): Mimumum confidence score for the region proposals.
      min_size (int, optional): Minimum size in pixels for the region proposals.
      iou_threshold (float, optional): Intersection-Over-Union threshold used during NMS.
      max_detections_per_image (int, optional): Maximum number of region proposals per image.
      n_pca_components (int, optional): Number of PCA components. Defaults to 16.
      feature_scaling_method (FeatureScalingMethod, optional): Scaling method applied to features before passing to
          KDE. Options are `norm` (normalize to unit vector length) and `scale` (scale to max length observed in
          training).
      max_training_points (int, optional): Maximum number of training points to fit the KDE model. Defaults to 40000.
class_docstr_tok: ["Region","Based","Anomaly","Detection","With","Real-Time","Training","and","Analysis",".","Args",":","roi_stage","(","RoiStage",",","optional",")",":","Processing","stage","from","which","rois","are","extracted",".","roi_score_threshold","(","float",",","optional",")",":","Mimumum","confidence","score","for","the","region","proposals",".","min_size","(","int",",","optional",")",":","Minimum","size","in","pixels","for","the","region","proposals",".","iou_threshold","(","float",",","optional",")",":","Intersection-Over-Union","threshold","used","during","NMS",".","max_detections_per_image","(","int",",","optional",")",":","Maximum","number","of","region","proposals","per","image",".","n_pca_components","(","int",",","optional",")",":","Number","of","PCA","components",".","Defaults","to","16.","feature_scaling_method","(","FeatureScalingMethod",",","optional",")",":","Scaling","method","applied","to","features","before","passing","to","KDE",".","Options","are","`","norm","`","(","normalize","to","unit","vector","length",")","and","`","scale","`","(","scale","to","max","length","observed","in","training",")",".","max_training_points","(","int",",","optional",")",":","Maximum","number","of","training","points","to","fit","the","KDE","model",".","Defaults","to","40000","."]
docstr: Fit a KDE Model to the embedding collected from the training set.
docstr_tok: ["Fit","a","KDE","Model","to","the","embedding","collected","from","the","training","set","."]
code: def on_validation_start(self) -> None:
      """Fit a KDE Model to the embedding collected from the training set."""
      embeddings = torch.vstack(self.embeddings)
  
      logger.info(
          "Fitting a KDE model to the embedding collected from the training set."
      )
      self.model.fit(embeddings)
  
file_path: anomalib/src/anomalib/models/rkde/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.components.classification import FeatureScalingMethod
  from .region_extractor import RoiStage
  from .torch_model import RkdeModel
label_desc: Use image node_id 4 for calling the Rkde obj's underlying member method code with example usage: obj.on_validation_start() without return types