class_docstr: Extracts regions from the image.
  
  Args:
      stage (RoiStage, optional): Processing stage from which rois are extracted.
      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.
class_docstr_tok: ["Extracts","regions","from","the","image",".","Args",":","stage","(","RoiStage",",","optional",")",":","Processing","stage","from","which","rois","are","extracted",".","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","."]
code: def __init__(
      self,
      stage: RoiStage = RoiStage.RCNN,
      score_threshold: float = 0.001,
      min_size: int = 25,
      iou_threshold: float = 0.3,
      max_detections_per_image: int = 100,
  ) -> None:
      super().__init__()
  
      # Affects global behaviour of the region extractor
      self.stage = stage
      self.min_size = min_size
      self.iou_threshold = iou_threshold
      self.max_detections_per_image = max_detections_per_image
  
      # Affects behaviour depending on roi stage
      rpn_top_n = (
          max_detections_per_image
          if self.stage == RoiStage.RPN
          else 1000
      )
      rpn_score_thresh = (
          score_threshold if self.stage == RoiStage.RPN else 0.0
      )
  
      # Create the model
      self.faster_rcnn = fasterrcnn_resnet50_fpn(
          pretrained=True,
          rpn_post_nms_top_n_test=rpn_top_n,
          rpn_score_thresh=rpn_score_thresh,
          box_score_thresh=score_threshold,
          box_nms_thresh=1.0,  # this disables nms (we apply custom label-agnostic nms during post-processing)
          box_detections_per_img=1000,  # this disables filtering top-k predictions (we apply our own after nms)
      )
  
file_path: anomalib/src/anomalib/models/rkde/region_extractor.py
imports: from __future__ import annotations
  from enum import Enum
  import torch
  from torch import Tensor, nn
  from torchvision.models.detection import fasterrcnn_resnet50_fpn
  from torchvision.ops import boxes
  from anomalib.data.utils.boxes import scale_boxes
label_desc: Use image node_id 1 to create a new RegionExtractor object from inherited base classes: nn with example: obj = RegionExtractor(stage, score_threshold, min_size, iou_threshold, max_detections_per_image)