class_docstr: Base class of samplers.
  
  Args:
      num (int): Number of samples
      pos_fraction (float): Fraction of positive samples
      neg_pos_up (int): Upper bound number of negative and
          positive samples. Defaults to -1.
      add_gt_as_proposals (bool): Whether to add ground truth
          boxes as proposals. Defaults to True.
code: def __init__(
      self,
      num: int,
      pos_fraction: float,
      neg_pos_ub: int = -1,
      add_gt_as_proposals: bool = True,
      **kwargs,
  ) -> None:
      self.num = num
      self.pos_fraction = pos_fraction
      self.neg_pos_ub = neg_pos_ub
      self.add_gt_as_proposals = add_gt_as_proposals
      self.pos_sampler = self
      self.neg_sampler = self
  
file_path: mmdetection/mmdet/models/task_modules/samplers/base_sampler.py
imports: from abc import ABCMeta, abstractmethod
  import torch
  from mmengine.structures import InstanceData
  from mmdet.structures.bbox import BaseBoxes, cat_boxes
  from ..assigners import AssignResult
  from .sampling_result import SamplingResult
label_desc: Use image node_id 1 to create a new BaseSampler object  with example: obj = BaseSampler(num, pos_fraction, neg_pos_ub, add_gt_as_proposals)