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","."]
docstr: Compute corresponding GT box and classification targets for
  proposals.
  
  Args:
      proposals_list (list[list]): Multi level points/bboxes of each
          image.
      valid_flag_list (list[list]): Multi level valid flags of each
          image.
      gt_bboxes_list (list[Tensor]): Ground truth bboxes of each image.
      img_metas (list[dict]): Meta info of each image.
      gt_bboxes_ignore_list (list[Tensor]): Ground truth bboxes to be
          ignored.
      gt_bboxes_list (list[Tensor]): Ground truth labels of each box.
      stage (str): `init` or `refine`. Generate target for init stage or
          refine stage
      label_channels (int): Channel of label.
      unmap_outputs (bool): Whether to map outputs back to the original
          set of anchors.
  
  Returns:
      tuple:
          - labels_list (list[Tensor]): Labels of each level.
          - label_weights_list (list[Tensor]): Label weights of each level.  # noqa: E501
          - bbox_gt_list (list[Tensor]): Ground truth bbox of each level.
          - proposal_list (list[Tensor]): Proposals(points/bboxes) of each level.  # noqa: E501
          - proposal_weights_list (list[Tensor]): Proposal weights of each level.  # noqa: E501
          - num_total_pos (int): Number of positive samples in all images.  # noqa: E501
          - num_total_neg (int): Number of negative samples in all images.  # noqa: E501
docstr_tok: ["Compute","corresponding","GT","box","and","classification","targets","for","proposals",".","Args",":","proposals_list","(","list","[","list","]",")",":","Multi","level","points\/bboxes","of","each","image",".","valid_flag_list","(","list","[","list","]",")",":","Multi","level","valid","flags","of","each","image",".","gt_bboxes_list","(","list","[","Tensor","]",")",":","Ground","truth","bboxes","of","each","image",".","img_metas","(","list","[","dict","]",")",":","Meta","info","of","each","image",".","gt_bboxes_ignore_list","(","list","[","Tensor","]",")",":","Ground","truth","bboxes","to","be","ignored",".","gt_bboxes_list","(","list","[","Tensor","]",")",":","Ground","truth","labels","of","each","box",".","stage","(","str",")",":","`","init","`","or","`","refine","`",".","Generate","target","for","init","stage","or","refine","stage","label_channels","(","int",")",":","Channel","of","label",".","unmap_outputs","(","bool",")",":","Whether","to","map","outputs","back","to","the","original","set","of","anchors",".","Returns",":","tuple",":","-","labels_list","(","list","[","Tensor","]",")",":","Labels","of","each","level",".","-","label_weights_list","(","list","[","Tensor","]",")",":","Label","weights","of","each","level",".","#","noqa",":","E501","-","bbox_gt_list","(","list","[","Tensor","]",")",":","Ground","truth","bbox","of","each","level",".","-","proposal_list","(","list","[","Tensor","]",")",":","Proposals","(","points\/bboxes",")","of","each","level",".","#","noqa",":","E501","-","proposal_weights_list","(","list","[","Tensor","]",")",":","Proposal","weights","of","each","level",".","#","noqa",":","E501","-","num_total_pos","(","int",")",":","Number","of","positive","samples","in","all","images",".","#","noqa",":","E501","-","num_total_neg","(","int",")",":","Number","of","negative","samples","in","all","images",".","#","noqa",":","E501"]
code: def get_targets(
      self,
      proposals_list,
      valid_flag_list,
      gt_bboxes_list,
      img_metas,
      gt_bboxes_ignore_list=None,
      gt_labels_list=None,
      stage="init",
      label_channels=1,
      unmap_outputs=True,
  ):
      """Compute corresponding GT box and classification targets for
      proposals.
  
      Args:
          proposals_list (list[list]): Multi level points/bboxes of each
              image.
          valid_flag_list (list[list]): Multi level valid flags of each
              image.
          gt_bboxes_list (list[Tensor]): Ground truth bboxes of each image.
          img_metas (list[dict]): Meta info of each image.
          gt_bboxes_ignore_list (list[Tensor]): Ground truth bboxes to be
              ignored.
          gt_bboxes_list (list[Tensor]): Ground truth labels of each box.
          stage (str): `init` or `refine`. Generate target for init stage or
              refine stage
          label_channels (int): Channel of label.
          unmap_outputs (bool): Whether to map outputs back to the original
              set of anchors.
  
      Returns:
          tuple:
              - labels_list (list[Tensor]): Labels of each level.
              - label_weights_list (list[Tensor]): Label weights of each level.  # noqa: E501
              - bbox_gt_list (list[Tensor]): Ground truth bbox of each level.
              - proposal_list (list[Tensor]): Proposals(points/bboxes) of each level.  # noqa: E501
              - proposal_weights_list (list[Tensor]): Proposal weights of each level.  # noqa: E501
              - num_total_pos (int): Number of positive samples in all images.  # noqa: E501
              - num_total_neg (int): Number of negative samples in all images.  # noqa: E501
      """
      assert stage in ["init", "refine"]
      num_imgs = len(img_metas)
      assert len(proposals_list) == len(valid_flag_list) == num_imgs
  
      # points number of multi levels
      num_level_proposals = [
          points.size(0) for points in proposals_list[0]
      ]
  
      # concat all level points and flags to a single tensor
      for i in range(num_imgs):
          assert len(proposals_list[i]) == len(valid_flag_list[i])
          proposals_list[i] = torch.cat(proposals_list[i])
          valid_flag_list[i] = torch.cat(valid_flag_list[i])
  
      # compute targets for each image
      if gt_bboxes_ignore_list is None:
          gt_bboxes_ignore_list = [None for _ in range(num_imgs)]
      if gt_labels_list is None:
          gt_labels_list = [None for _ in range(num_imgs)]
      (
          all_labels,
          all_label_weights,
          all_bbox_gt,
          all_proposals,
          all_proposal_weights,
          pos_inds_list,
          neg_inds_list,
      ) = multi_apply(
          self._point_target_single,
          proposals_list,
          valid_flag_list,
          gt_bboxes_list,
          gt_bboxes_ignore_list,
          gt_labels_list,
          stage=stage,
          label_channels=label_channels,
          unmap_outputs=unmap_outputs,
      )
      # no valid points
      if any([labels is None for labels in all_labels]):
          return None
      # sampled points of all images
      num_total_pos = sum(
          [max(inds.numel(), 1) for inds in pos_inds_list]
      )
      num_total_neg = sum(
          [max(inds.numel(), 1) for inds in neg_inds_list]
      )
      labels_list = images_to_levels(all_labels, num_level_proposals)
      label_weights_list = images_to_levels(
          all_label_weights, num_level_proposals
      )
      bbox_gt_list = images_to_levels(all_bbox_gt, num_level_proposals)
      proposals_list = images_to_levels(
          all_proposals, num_level_proposals
      )
      proposal_weights_list = images_to_levels(
          all_proposal_weights, num_level_proposals
      )
      return (
          labels_list,
          label_weights_list,
          bbox_gt_list,
          proposals_list,
          proposal_weights_list,
          num_total_pos,
          num_total_neg,
      )
  
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 12 for calling the RepPointsHead obj's underlying member method code with example usage: obj.get_targets(proposals_list, valid_flag_list, gt_bboxes_list, img_metas, gt_bboxes_ignore_list, gt_labels_list, stage, label_channels, unmap_outputs) and returns: labels_list,  label_weights_list,  bbox_gt_list,  proposals_list,  proposal_weights_list,  num_total_pos,  num_total_neg, None