code: def __init__(
      self,
      box_roi_pool,
      box_head,
      box_predictor,
      # Faster R-CNN training
      fg_iou_thresh,
      bg_iou_thresh,
      batch_size_per_image,
      positive_fraction,
      bbox_reg_weights,
      # Faster R-CNN inference
      score_thresh,
      nms_thresh,
      detections_per_img,
      # Mask
      mask_roi_pool=None,
      mask_head=None,
      mask_predictor=None,
      keypoint_roi_pool=None,
      keypoint_head=None,
      keypoint_predictor=None,
  ):
      super().__init__()
  
      self.box_similarity = box_ops.box_iou
      # assign ground-truth boxes for each proposal
      self.proposal_matcher = det_utils.Matcher(
          fg_iou_thresh, bg_iou_thresh, allow_low_quality_matches=False
      )
  
      self.fg_bg_sampler = det_utils.BalancedPositiveNegativeSampler(
          batch_size_per_image, positive_fraction
      )
  
      if bbox_reg_weights is None:
          bbox_reg_weights = (10.0, 10.0, 5.0, 5.0)
      self.box_coder = det_utils.BoxCoder(bbox_reg_weights)
  
      self.box_roi_pool = box_roi_pool
      self.box_head = box_head
      self.box_predictor = box_predictor
  
      self.score_thresh = score_thresh
      self.nms_thresh = nms_thresh
      self.detections_per_img = detections_per_img
  
      self.mask_roi_pool = mask_roi_pool
      self.mask_head = mask_head
      self.mask_predictor = mask_predictor
  
      self.keypoint_roi_pool = keypoint_roi_pool
      self.keypoint_head = keypoint_head
      self.keypoint_predictor = keypoint_predictor
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn.functional
  import torchvision
  from torch import nn, Tensor
  from torchvision.ops import boxes, roi_align
  from .None import _utils
label_desc: Use image node_id 1 to create a new RoIHeads object from inherited base classes: nn with example: obj = RoIHeads(box_roi_pool, box_head, box_predictor, fg_iou_thresh, bg_iou_thresh, batch_size_per_image, positive_fraction, bbox_reg_weights, score_thresh, nms_thresh, detections_per_img, mask_roi_pool, mask_head, mask_predictor, keypoint_roi_pool, keypoint_head, keypoint_predictor)