class_docstr: IoU Balanced Sampling.
  
  arXiv: https://arxiv.org/pdf/1904.02701.pdf (CVPR 2019)
  
  Sampling proposals according to their IoU. `floor_fraction` of needed RoIs
  are sampled from proposals whose IoU are lower than `floor_thr` randomly.
  The others are sampled from proposals whose IoU are higher than
  `floor_thr`. These proposals are sampled from some bins evenly, which are
  split by `num_bins` via IoU evenly.
  
  Args:
      num (int): number of proposals.
      pos_fraction (float): fraction of positive proposals.
      floor_thr (float): threshold (minimum) IoU for IoU balanced sampling,
          set to -1 if all using IoU balanced sampling.
      floor_fraction (float): sampling fraction of proposals under floor_thr.
      num_bins (int): number of bins in IoU balanced sampling.
docstr: Sample according to the iou interval.
  
  Args:
      max_overlaps (torch.Tensor): IoU between bounding boxes and ground
          truth boxes.
      full_set (set(int)): A full set of indices of boxes。
      num_expected (int): Number of expected samples。
  
  Returns:
      np.ndarray: Indices  of samples
code: def sample_via_interval(self, max_overlaps, full_set, num_expected):
      """Sample according to the iou interval.
  
      Args:
          max_overlaps (torch.Tensor): IoU between bounding boxes and ground
              truth boxes.
          full_set (set(int)): A full set of indices of boxes。
          num_expected (int): Number of expected samples。
  
      Returns:
          np.ndarray: Indices  of samples
      """
      max_iou = max_overlaps.max()
      iou_interval = (max_iou - self.floor_thr) / self.num_bins
      per_num_expected = int(num_expected / self.num_bins)
  
      sampled_inds = []
      for i in range(self.num_bins):
          start_iou = self.floor_thr + i * iou_interval
          end_iou = self.floor_thr + (i + 1) * iou_interval
          tmp_set = set(
              np.where(
                  np.logical_and(
                      max_overlaps >= start_iou, max_overlaps < end_iou
                  )
              )[0]
          )
          tmp_inds = list(tmp_set & full_set)
          if len(tmp_inds) > per_num_expected:
              tmp_sampled_set = self.random_choice(
                  tmp_inds, per_num_expected
              )
          else:
              tmp_sampled_set = np.array(tmp_inds, dtype=np.int64)
          sampled_inds.append(tmp_sampled_set)
  
      sampled_inds = np.concatenate(sampled_inds)
      if len(sampled_inds) < num_expected:
          num_extra = num_expected - len(sampled_inds)
          extra_inds = np.array(list(full_set - set(sampled_inds)))
          if len(extra_inds) > num_extra:
              extra_inds = self.random_choice(extra_inds, num_extra)
          sampled_inds = np.concatenate([sampled_inds, extra_inds])
  
      return sampled_inds
  
file_path: mmdetection/mmdet/models/task_modules/samplers/iou_balanced_neg_sampler.py
imports: import numpy
  import torch
  from mmdet.registry import TASK_UTILS
  from .random_sampler import RandomSampler
label_desc: Use image node_id 2 for calling the IoUBalancedNegSampler obj's underlying member method code with example usage: obj.sample_via_interval(max_overlaps, full_set, num_expected) and returns: sampled_inds