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 _point_target_single(
      self,
      flat_proposals,
      valid_flags,
      gt_bboxes,
      gt_bboxes_ignore,
      gt_labels,
      label_channels=1,
      stage="init",
      unmap_outputs=True,
  ):
      inside_flags = valid_flags
      if not inside_flags.any():
          return (None,) * 7
      # assign gt and sample proposals
      proposals = flat_proposals[inside_flags, :]
  
      if stage == "init":
          assigner = self.init_assigner
          pos_weight = self.train_cfg.init.pos_weight
      else:
          assigner = self.refine_assigner
          pos_weight = self.train_cfg.refine.pos_weight
      assign_result = assigner.assign(
          proposals,
          gt_bboxes,
          gt_bboxes_ignore,
          None if self.sampling else gt_labels,
      )
      sampling_result = self.sampler.sample(
          assign_result, proposals, gt_bboxes
      )
  
      num_valid_proposals = proposals.shape[0]
      bbox_gt = proposals.new_zeros([num_valid_proposals, 4])
      pos_proposals = torch.zeros_like(proposals)
      proposals_weights = proposals.new_zeros([num_valid_proposals, 4])
      labels = proposals.new_full(
          (num_valid_proposals,), self.num_classes, dtype=torch.long
      )
      label_weights = proposals.new_zeros(
          num_valid_proposals, dtype=torch.float
      )
  
      pos_inds = sampling_result.pos_inds
      neg_inds = sampling_result.neg_inds
      if len(pos_inds) > 0:
          pos_gt_bboxes = sampling_result.pos_gt_bboxes
          bbox_gt[pos_inds, :] = pos_gt_bboxes
          pos_proposals[pos_inds, :] = proposals[pos_inds, :]
          proposals_weights[pos_inds, :] = 1.0
          if gt_labels is None:
              # Only rpn gives gt_labels as None
              # Foreground is the first class
              labels[pos_inds] = 0
          else:
              labels[pos_inds] = gt_labels[
                  sampling_result.pos_assigned_gt_inds
              ]
          if pos_weight <= 0:
              label_weights[pos_inds] = 1.0
          else:
              label_weights[pos_inds] = pos_weight
      if len(neg_inds) > 0:
          label_weights[neg_inds] = 1.0
  
      # map up to original set of proposals
      if unmap_outputs:
          num_total_proposals = flat_proposals.size(0)
          labels = unmap(labels, num_total_proposals, inside_flags)
          label_weights = unmap(
              label_weights, num_total_proposals, inside_flags
          )
          bbox_gt = unmap(bbox_gt, num_total_proposals, inside_flags)
          pos_proposals = unmap(
              pos_proposals, num_total_proposals, inside_flags
          )
          proposals_weights = unmap(
              proposals_weights, num_total_proposals, inside_flags
          )
  
      return (
          labels,
          label_weights,
          bbox_gt,
          pos_proposals,
          proposals_weights,
          pos_inds,
          neg_inds,
      )
  
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 11 for calling the RepPointsHead obj's underlying member method code with example usage: obj._point_target_single(flat_proposals, valid_flags, gt_bboxes, gt_bboxes_ignore, gt_labels, label_channels, stage, unmap_outputs) and returns: labels,  label_weights,  bbox_gt,  pos_proposals,  proposals_weights,  pos_inds,  neg_inds, unknown