class_docstr: Online Hard Example Mining Sampler described in `Training Region-based
  Object Detectors with Online Hard Example Mining
  <https://arxiv.org/abs/1604.03540>`_.
code: def __init__(
      self,
      num,
      pos_fraction,
      context,
      neg_pos_ub=-1,
      add_gt_as_proposals=True,
      loss_key="loss_cls",
      **kwargs,
  ):
      super(OHEMSampler, self).__init__(
          num, pos_fraction, neg_pos_ub, add_gt_as_proposals
      )
      self.context = context
      if not hasattr(self.context, "num_stages"):
          self.bbox_head = self.context.bbox_head
      else:
          self.bbox_head = self.context.bbox_head[
              self.context.current_stage
          ]
  
      self.loss_key = loss_key
  
file_path: mmdetection/mmdet/models/task_modules/samplers/ohem_sampler.py
imports: import torch
  from mmdet.registry import TASK_UTILS
  from mmdet.structures.bbox import bbox2roi
  from .base_sampler import BaseSampler
label_desc: Use image node_id 1 to create a new OHEMSampler object from inherited base classes: BaseSampler with example: obj = OHEMSampler(num, pos_fraction, context, neg_pos_ub, add_gt_as_proposals, loss_key)