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","."]
code: def __init__(
      self,
      box_score_thresh: float = 0.8,
      persons_only: bool = False,
      min_bbox_area: int = 100,
      max_bbox_overlap: float = 0.65,
      enable_foreground_detections: bool = True,
      foreground_kernel_size: int = 3,
      foreground_binary_threshold: int = 18,
  ) -> None:
      super().__init__()
  
      self.persons_only = persons_only
      self.min_bbox_area = min_bbox_area
      self.max_bbox_overlap = max_bbox_overlap
      self.enable_foreground_detections = enable_foreground_detections
      self.foreground_kernel_size = foreground_kernel_size
      self.foreground_binary_threshold = foreground_binary_threshold
  
      weights = MaskRCNN_ResNet50_FPN_V2_Weights.DEFAULT
      self.backbone = maskrcnn_resnet50_fpn_v2(
          weights=weights,
          box_score_thresh=box_score_thresh,
          rpn_nms_thresh=0.3,
      )
  
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 1 to create a new RegionExtractor object from inherited base classes: nn with example: obj = RegionExtractor(box_score_thresh, persons_only, min_bbox_area, max_bbox_overlap, enable_foreground_detections, foreground_kernel_size, foreground_binary_threshold)