class_docstr: PatchcoreLightning Module to train PatchCore algorithm.
  
  Args:
      input_size (tuple[int, int]): Size of the model input.
      backbone (str): Backbone CNN network
      layers (list[str]): Layers to extract features from the backbone CNN
      pre_trained (bool, optional): Boolean to check whether to use a pre_trained backbone.
      coreset_sampling_ratio (float, optional): Coreset sampling ratio to subsample embedding.
          Defaults to 0.1.
      num_neighbors (int, optional): Number of nearest neighbors. Defaults to 9.
class_docstr_tok: ["PatchcoreLightning","Module","to","train","PatchCore","algorithm",".","Args",":","input_size","(","tuple","[","int",",","int","]",")",":","Size","of","the","model","input",".","backbone","(","str",")",":","Backbone","CNN","network","layers","(","list","[","str","]",")",":","Layers","to","extract","features","from","the","backbone","CNN","pre_trained","(","bool",",","optional",")",":","Boolean","to","check","whether","to","use","a","pre_trained","backbone",".","coreset_sampling_ratio","(","float",",","optional",")",":","Coreset","sampling","ratio","to","subsample","embedding",".","Defaults","to","0.1.","num_neighbors","(","int",",","optional",")",":","Number","of","nearest","neighbors",".","Defaults","to","9","."]
docstr: Get batch of anomaly maps from input image batch.
  
  Args:
      batch (dict[str, str | Tensor]): Batch containing image filename,
          image, label and mask
  
  Returns:
      dict[str, Any]: Image filenames, test images, GT and predicted label/masks
docstr_tok: ["Get","batch","of","anomaly","maps","from","input","image","batch",".","Args",":","batch","(","dict","[","str",",","str","|","Tensor","]",")",":","Batch","containing","image","filename",",","image",",","label","and","mask","Returns",":","dict","[","str",",","Any","]",":","Image","filenames",",","test","images",",","GT","and","predicted","label\/masks"]
code: def validation_step(
      self, batch: dict[str, str | Tensor], *args, **kwargs
  ) -> STEP_OUTPUT:
      """Get batch of anomaly maps from input image batch.
  
      Args:
          batch (dict[str, str | Tensor]): Batch containing image filename,
              image, label and mask
  
      Returns:
          dict[str, Any]: Image filenames, test images, GT and predicted label/masks
      """
      # These variables are not used.
      del args, kwargs
  
      # Get anomaly maps and predicted scores from the model.
      output = self.model(batch["image"])
  
      # Add anomaly maps and predicted scores to the batch.
      batch["anomaly_maps"] = output["anomaly_map"]
      batch["pred_scores"] = output["pred_score"]
  
      return batch
  
file_path: anomalib/src/anomalib/models/patchcore/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.patchcore.torch_model import PatchcoreModel
label_desc: Use image node_id 5 for calling the Patchcore obj's underlying member method code with example usage: obj.validation_step(batch) and returns: batch