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: Helper method that subsamples the items in a region dictionary based on a Tensor of indices.
  
  Args:
      regions (dict[str, Tensor]): Region detections for a single image in the batch.
      indices (Tensor): Indices of region detections that should be kept.
  
  Returns:
      dict[str, Tensor]: Subsampled region detections.
docstr_tok: ["Helper","method","that","subsamples","the","items","in","a","region","dictionary","based","on","a","Tensor","of","indices",".","Args",":","regions","(","dict","[","str",",","Tensor","]",")",":","Region","detections","for","a","single","image","in","the","batch",".","indices","(","Tensor",")",":","Indices","of","region","detections","that","should","be","kept",".","Returns",":","dict","[","str",",","Tensor","]",":","Subsampled","region","detections","."]
code: def subsample_regions(
      regions: dict[str, Tensor], indices: Tensor
  ) -> dict[str, Tensor]:
      """Helper method that subsamples the items in a region dictionary based on a Tensor of indices.
  
      Args:
          regions (dict[str, Tensor]): Region detections for a single image in the batch.
          indices (Tensor): Indices of region detections that should be kept.
  
      Returns:
          dict[str, Tensor]: Subsampled region detections.
      """
      new_regions_dict = {}
      for key, value in regions.items():
          new_regions_dict[key] = value[indices]
      return new_regions_dict
  
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 8 for calling the RegionExtractor obj's underlying member method code with example usage: obj.subsample_regions(regions, indices) and returns: new_regions_dict