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 hard_mining(self, inds, num_expected, bboxes, labels, feats):
      with torch.no_grad():
          rois = bbox2roi([bboxes])
          if not hasattr(self.context, "num_stages"):
              bbox_results = self.context._bbox_forward(feats, rois)
          else:
              bbox_results = self.context._bbox_forward(
                  self.context.current_stage, feats, rois
              )
          cls_score = bbox_results["cls_score"]
          loss = self.bbox_head.loss(
              cls_score=cls_score,
              bbox_pred=None,
              rois=rois,
              labels=labels,
              label_weights=cls_score.new_ones(cls_score.size(0)),
              bbox_targets=None,
              bbox_weights=None,
              reduction_override="none",
          )[self.loss_key]
          _, topk_loss_inds = loss.topk(num_expected)
      return inds[topk_loss_inds]
  
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 2 for calling the OHEMSampler obj's underlying member method code with example usage: obj.hard_mining(inds, num_expected, bboxes, labels, feats) and returns: inds