class_docstr: Torch Model for the Region-based Anomaly Detection Model.
  
  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: Prediction by normality model.
  
  Args:
      input (Tensor): Input images.
  
  Returns:
      Tensor | tuple[Tensor, Tensor]: The extracted features (when in training mode), or the predicted rois
          and corresponding anomaly scores.
code: def forward(self, batch: Tensor) -> Tensor | tuple[Tensor, Tensor]:
      """Prediction by normality model.
  
      Args:
          input (Tensor): Input images.
  
      Returns:
          Tensor | tuple[Tensor, Tensor]: The extracted features (when in training mode), or the predicted rois
              and corresponding anomaly scores.
      """
      self.region_extractor.eval()
      self.feature_extractor.eval()
  
      # 1. apply region extraction
      rois = self.region_extractor(batch)
  
      # 2. apply feature extraction
      if rois.shape[0] == 0:
          # cannot extract features when no rois are retrieved
          features = torch.empty((0, 4096)).to(batch.device)
      else:
          features = self.feature_extractor(batch, rois.clone())
  
      if self.training:
          return features
  
      # 3. apply density estimation
      scores = self.classifier(features)
  
      return rois, scores
  
file_path: anomalib/src/anomalib/models/rkde/torch_model.py
imports: from __future__ import annotations
  import logging
  import torch
  from torch import Tensor, nn
  from anomalib.models.components.classification import FeatureScalingMethod, KDEClassifier
  from anomalib.models.rkde.feature_extractor import FeatureExtractor
  from anomalib.models.rkde.region_extractor import RegionExtractor, RoiStage
label_desc: Use image node_id 3 for calling the RkdeModel obj's underlying member method code with example usage: obj.forward(batch) and returns: rois,  scores, features