class_docstr: RepPoint head.
  
  Args:
      point_feat_channels (int): Number of channels of points features.
      gradient_mul (float): The multiplier to gradients from
          points refinement and recognition.
      point_strides (Iterable): points strides.
      point_base_scale (int): bbox scale for assigning labels.
      loss_cls (dict): Config of classification loss.
      loss_bbox_init (dict): Config of initial points loss.
      loss_bbox_refine (dict): Config of points loss in refinement.
      use_grid_points (bool): If we use bounding box representation, the
      reppoints is represented as grid points on the bounding box.
      center_init (bool): Whether to use center point assignment.
      transform_method (str): The methods to transform RepPoints to bbox.
class_docstr_tok: ["RepPoint","head",".","Args",":","point_feat_channels","(","int",")",":","Number","of","channels","of","points","features",".","gradient_mul","(","float",")",":","The","multiplier","to","gradients","from","points","refinement","and","recognition",".","point_strides","(","Iterable",")",":","points","strides",".","point_base_scale","(","int",")",":","bbox","scale","for","assigning","labels",".","loss_cls","(","dict",")",":","Config","of","classification","loss",".","loss_bbox_init","(","dict",")",":","Config","of","initial","points","loss",".","loss_bbox_refine","(","dict",")",":","Config","of","points","loss","in","refinement",".","use_grid_points","(","bool",")",":","If","we","use","bounding","box","representation",",","the","reppoints","is","represented","as","grid","points","on","the","bounding","box",".","center_init","(","bool",")",":","Whether","to","use","center","point","assignment",".","transform_method","(","str",")",":","The","methods","to","transform","RepPoints","to","bbox","."]
code: def _get_bboxes_single(
      self,
      cls_scores,
      bbox_preds,
      mlvl_points,
      img_shape,
      scale_factor,
      cfg,
      rescale=False,
      with_nms=True,
  ):
      cfg = self.test_cfg if cfg is None else cfg
      assert len(cls_scores) == len(bbox_preds) == len(mlvl_points)
      mlvl_bboxes = []
      mlvl_scores = []
      for i_lvl, (cls_score, bbox_pred, points) in enumerate(
          zip(cls_scores, bbox_preds, mlvl_points)
      ):
          assert cls_score.size()[-2:] == bbox_pred.size()[-2:]
          cls_score = cls_score.permute(1, 2, 0).reshape(
              -1, self.cls_out_channels
          )
          if self.use_sigmoid_cls:
              scores = cls_score.sigmoid()
          else:
              scores = cls_score.softmax(-1)
          bbox_pred = bbox_pred.permute(1, 2, 0).reshape(-1, 4)
          nms_pre = cfg.get("nms_pre", -1)
          if nms_pre > 0 and scores.shape[0] > nms_pre:
              if self.use_sigmoid_cls:
                  max_scores, _ = scores.max(dim=1)
              else:
                  # remind that we set FG labels to [0, num_class-1]
                  # since mmdet v2.0
                  # BG cat_id: num_class
                  max_scores, _ = scores[:, :-1].max(dim=1)
              _, topk_inds = max_scores.topk(nms_pre)
              points = points[topk_inds, :]
              bbox_pred = bbox_pred[topk_inds, :]
              scores = scores[topk_inds, :]
          bbox_pos_center = torch.cat(
              [points[:, :2], points[:, :2]], dim=1
          )
          bboxes = (
              bbox_pred * self.point_strides[i_lvl] + bbox_pos_center
          )
          x1 = bboxes[:, 0].clamp(min=0, max=img_shape[1])
          y1 = bboxes[:, 1].clamp(min=0, max=img_shape[0])
          x2 = bboxes[:, 2].clamp(min=0, max=img_shape[1])
          y2 = bboxes[:, 3].clamp(min=0, max=img_shape[0])
          bboxes = torch.stack([x1, y1, x2, y2], dim=-1)
          mlvl_bboxes.append(bboxes)
          mlvl_scores.append(scores)
      mlvl_bboxes = torch.cat(mlvl_bboxes)
      if rescale:
          mlvl_bboxes /= mlvl_bboxes.new_tensor(scale_factor)
      mlvl_scores = torch.cat(mlvl_scores)
      if self.use_sigmoid_cls:
          # Add a dummy background class to the backend when using sigmoid
          # remind that we set FG labels to [0, num_class-1] since mmdet v2.0
          # BG cat_id: num_class
          padding = mlvl_scores.new_zeros(mlvl_scores.shape[0], 1)
          mlvl_scores = torch.cat([mlvl_scores, padding], dim=1)
      if with_nms:
          det_bboxes, det_labels = multiclass_nms(
              mlvl_bboxes,
              mlvl_scores,
              cfg.score_thr,
              cfg.nms,
              cfg.max_per_img,
          )
          return det_bboxes, det_labels
      else:
          return mlvl_bboxes, mlvl_scores
  
imports: import numpy
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init
  from mmcv.ops import DeformConv2d
  from mmdet.core import PointGenerator, build_assigner, build_sampler, images_to_levels, multi_apply, multiclass_nms, unmap
  from ..builder import HEADS, build_loss
  from .anchor_free_head import AnchorFreeHead
label_desc: Use image node_id 16 for calling the RepPointsHead obj's underlying member method code with example usage: obj._get_bboxes_single(cls_scores, bbox_preds, mlvl_points, img_shape, scale_factor, cfg, rescale, with_nms) and returns: det_bboxes,  det_labels, mlvl_bboxes,  mlvl_scores