class_docstr: Region extractor for AI-VAD.
  
  Args:
      box_score_thresh (float): Confidence threshold for bounding box predictions.
      persons_only (bool): When enabled, only regions labeled as person are included.
      min_bbox_area (int): Minimum bounding box area. Regions with a surface area lower than this value are excluded.
      max_bbox_overlap (float): Maximum allowed overlap between bounding boxes.
      enable_foreground_detections (bool): Add additional foreground detections based on pixel difference between
          consecutive frames.
      foreground_kernel_size (int): Gaussian kernel size used in foreground detection.
      foreground_binary_threshold (int): Value between 0 and 255 which acts as binary threshold in foreground
          detection.
class_docstr_tok: ["Region","extractor","for","AI-VAD",".","Args",":","box_score_thresh","(","float",")",":","Confidence","threshold","for","bounding","box","predictions",".","persons_only","(","bool",")",":","When","enabled",",","only","regions","labeled","as","person","are","included",".","min_bbox_area","(","int",")",":","Minimum","bounding","box","area",".","Regions","with","a","surface","area","lower","than","this","value","are","excluded",".","max_bbox_overlap","(","float",")",":","Maximum","allowed","overlap","between","bounding","boxes",".","enable_foreground_detections","(","bool",")",":","Add","additional","foreground","detections","based","on","pixel","difference","between","consecutive","frames",".","foreground_kernel_size","(","int",")",":","Gaussian","kernel","size","used","in","foreground","detection",".","foreground_binary_threshold","(","int",")",":","Value","between","0","and","255","which","acts","as","binary","threshold","in","foreground","detection","."]
docstr: Post-process the region detections.
  
  The region detections are filtered based on class label, bbox area and overlap with other regions.
  
  Args:
      regions (list[dict[str, Tensor]]): Region detections for a batch of images, generated by the region
          extraction module.
  
  Returns:
      list[dict[str, Tensor]]: Filtered regions
docstr_tok: ["Post-process","the","region","detections",".","The","region","detections","are","filtered","based","on","class","label",",","bbox","area","and","overlap","with","other","regions",".","Args",":","regions","(","list","[","dict","[","str",",","Tensor","]","]",")",":","Region","detections","for","a","batch","of","images",",","generated","by","the","region","extraction","module",".","Returns",":","list","[","dict","[","str",",","Tensor","]","]",":","Filtered","regions"]
code: def post_process_bbox_detections(
      self, regions: list[dict[str, Tensor]]
  ) -> list[dict[str, Tensor]]:
      """Post-process the region detections.
  
      The region detections are filtered based on class label, bbox area and overlap with other regions.
  
      Args:
          regions (list[dict[str, Tensor]]): Region detections for a batch of images, generated by the region
              extraction module.
  
      Returns:
          list[dict[str, Tensor]]: Filtered regions
      """
      filtered_regions = []
      for im_regions in regions:
          if self.persons_only:
              im_regions = self._keep_only_persons(im_regions)
          im_regions = self._filter_by_area(
              im_regions, self.min_bbox_area
          )
          im_regions = self._delete_overlapping_boxes(
              im_regions, self.max_bbox_overlap
          )
          filtered_regions.append(im_regions)
      return filtered_regions
  
file_path: anomalib/src/anomalib/models/ai_vad/regions.py
imports: from __future__ import annotations
  import torch
  from torch import Tensor, nn
  from torchvision.models.detection import MaskRCNN_ResNet50_FPN_V2_Weights, maskrcnn_resnet50_fpn_v2
  from torchvision.ops import box_area, clip_boxes_to_image
  from torchvision.transforms.functional import gaussian_blur, rgb_to_grayscale
  from anomalib.data.utils.boxes import boxes_to_masks, masks_to_boxes
label_desc: Use image node_id 4 for calling the RegionExtractor obj's underlying member method code with example usage: obj.post_process_bbox_detections(regions) and returns: filtered_regions