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","."]
docstr: Post-processes the box predictions.
  
  The post-processing consists of removing small boxes, applying nms, and
  keeping only the k boxes with the highest confidence score.
  
  Args:
      pred_boxes (Tensor): Box predictions of shape (N, 4).
      pred_scores (Tensor): Tensor of shape () with a confidence score for each box prediction.
  
  Returns:
      list[Tensor]: Post-processed box predictions of shape (N, 4).
docstr_tok: ["Post-processes","the","box","predictions",".","The","post-processing","consists","of","removing","small","boxes",",","applying","nms",",","and","keeping","only","the","k","boxes","with","the","highest","confidence","score",".","Args",":","pred_boxes","(","Tensor",")",":","Box","predictions","of","shape","(","N",",","4",")",".","pred_scores","(","Tensor",")",":","Tensor","of","shape","(",")","with","a","confidence","score","for","each","box","prediction",".","Returns",":","list","[","Tensor","]",":","Post-processed","box","predictions","of","shape","(","N",",","4",")","."]
code: def post_process_box_predictions(
      self, pred_boxes: Tensor, pred_scores: Tensor
  ) -> list[Tensor]:
      """Post-processes the box predictions.
  
      The post-processing consists of removing small boxes, applying nms, and
      keeping only the k boxes with the highest confidence score.
  
      Args:
          pred_boxes (Tensor): Box predictions of shape (N, 4).
          pred_scores (Tensor): Tensor of shape () with a confidence score for each box prediction.
  
      Returns:
          list[Tensor]: Post-processed box predictions of shape (N, 4).
      """
  
      processed_boxes: list[Tensor] = []
      for boxes, scores in zip(pred_boxes, pred_scores):
          # remove small boxes
          keep = box_ops.remove_small_boxes(
              boxes, min_size=self.min_size
          )
          boxes, scores = boxes[keep], scores[keep]
  
          # non-maximum suppression, all boxes together
          keep = box_ops.nms(boxes, scores, self.iou_threshold)
  
          # keep only top-k scoring predictions
          keep = keep[: self.max_detections_per_image]
          boxes = boxes[keep]
  
          processed_boxes.append(boxes)
  
      return processed_boxes
  
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 3 for calling the RegionExtractor obj's underlying member method code with example usage: obj.post_process_box_predictions(pred_boxes, pred_scores) and returns: processed_boxes