class_docstr: RepPoint head.
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      point_feat_channels (int): Number of channels of points features.
      num_points (int): Number of points.
      gradient_mul (float): The multiplier to gradients from
          points refinement and recognition.
      point_strides (Sequence[int]): points strides.
      point_base_scale (int): bbox scale for assigning labels.
      loss_cls (:obj:`ConfigDict` or dict): Config of classification loss.
      loss_bbox_init (:obj:`ConfigDict` or dict): Config of initial points
          loss.
      loss_bbox_refine (:obj:`ConfigDict` or 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.
      init_cfg (:obj:`ConfigDict` or dict or list[:obj:`ConfigDict` or             dict]): Initialization config dict.
class_docstr_tok: ["RepPoint","head",".","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","point_feat_channels","(","int",")",":","Number","of","channels","of","points","features",".","num_points","(","int",")",":","Number","of","points",".","gradient_mul","(","float",")",":","The","multiplier","to","gradients","from","points","refinement","and","recognition",".","point_strides","(","Sequence","[","int","]",")",":","points","strides",".","point_base_scale","(","int",")",":","bbox","scale","for","assigning","labels",".","loss_cls","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","classification","loss",".","loss_bbox_init","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","initial","points","loss",".","loss_bbox_refine","(",":","obj",":","`","ConfigDict","`","or","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",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict","or","list","[",":","obj",":","`","ConfigDict","`","or","dict","]",")",":","Initialization","config","dict","."]
docstr: Compute corresponding GT box and classification targets for
  proposals.
  
  Args:
      proposals_list (list[Tensor]): Multi level points/bboxes of each
          image.
      valid_flag_list (list[Tensor]): Multi level valid flags of each
          image.
      batch_gt_instances (list[:obj:`InstanceData`]): Batch of
          gt_instance. It usually includes ``bboxes`` and ``labels``
          attributes.
      batch_img_metas (list[dict]): Meta information of each image, e.g.,
          image size, scaling factor, etc.
      batch_gt_instances_ignore (list[:obj:`InstanceData`], optional):
          Batch of gt_instances_ignore. It includes ``bboxes`` attribute
          data that is ignored during training and testing.
          Defaults to None.
      stage (str): 'init' or 'refine'. Generate target for init stage or
          refine stage.
      unmap_outputs (bool): Whether to map outputs back to the original
          set of anchors.
      return_sampling_results (bool): Whether to return the sampling
          results. Defaults to False.
  
  Returns:
      tuple:
  
          - labels_list (list[Tensor]): Labels of each level.
          - label_weights_list (list[Tensor]): Label weights of each
            level.
          - bbox_gt_list (list[Tensor]): Ground truth bbox of each level.
          - proposals_list (list[Tensor]): Proposals(points/bboxes) of
            each level.
          - proposal_weights_list (list[Tensor]): Proposal weights of
            each level.
          - avg_factor (int): Average factor that is used to average
            the loss. When using sampling method, avg_factor is usually
            the sum of positive and negative priors. When using
            `PseudoSampler`, `avg_factor` is usually equal to the number
            of positive priors.
docstr_tok: ["Compute","corresponding","GT","box","and","classification","targets","for","proposals",".","Args",":","proposals_list","(","list","[","Tensor","]",")",":","Multi","level","points\/bboxes","of","each","image",".","valid_flag_list","(","list","[","Tensor","]",")",":","Multi","level","valid","flags","of","each","image",".","batch_gt_instances","(","list","[",":","obj",":","`","InstanceData","`","]",")",":","Batch","of","gt_instance",".","It","usually","includes","``","bboxes","``","and","``","labels","``","attributes",".","batch_img_metas","(","list","[","dict","]",")",":","Meta","information","of","each","image",",","e.g.",",","image","size",",","scaling","factor",",","etc",".","batch_gt_instances_ignore","(","list","[",":","obj",":","`","InstanceData","`","]",",","optional",")",":","Batch","of","gt_instances_ignore",".","It","includes","``","bboxes","``","attribute","data","that","is","ignored","during","training","and","testing",".","Defaults","to","None",".","stage","(","str",")",":","'init","'","or","'refine","'",".","Generate","target","for","init","stage","or","refine","stage",".","unmap_outputs","(","bool",")",":","Whether","to","map","outputs","back","to","the","original","set","of","anchors",".","return_sampling_results","(","bool",")",":","Whether","to","return","the","sampling","results",".","Defaults","to","False",".","Returns",":","tuple",":","-","labels_list","(","list","[","Tensor","]",")",":","Labels","of","each","level",".","-","label_weights_list","(","list","[","Tensor","]",")",":","Label","weights","of","each","level",".","-","bbox_gt_list","(","list","[","Tensor","]",")",":","Ground","truth","bbox","of","each","level",".","-","proposals_list","(","list","[","Tensor","]",")",":","Proposals","(","points\/bboxes",")","of","each","level",".","-","proposal_weights_list","(","list","[","Tensor","]",")",":","Proposal","weights","of","each","level",".","-","avg_factor","(","int",")",":","Average","factor","that","is","used","to","average","the","loss",".","When","using","sampling","method",",","avg_factor","is","usually","the","sum","of","positive","and","negative","priors",".","When","using","`","PseudoSampler","`",",","`","avg_factor","`","is","usually","equal","to","the","number","of","positive","priors","."]
code: def get_targets(
      self,
      proposals_list: List[Tensor],
      valid_flag_list: List[Tensor],
      batch_gt_instances: InstanceList,
      batch_img_metas: List[dict],
      batch_gt_instances_ignore: OptInstanceList = None,
      stage: str = "init",
      unmap_outputs: bool = True,
      return_sampling_results: bool = False,
  ) -> tuple:
      """Compute corresponding GT box and classification targets for
      proposals.
  
      Args:
          proposals_list (list[Tensor]): Multi level points/bboxes of each
              image.
          valid_flag_list (list[Tensor]): Multi level valid flags of each
              image.
          batch_gt_instances (list[:obj:`InstanceData`]): Batch of
              gt_instance. It usually includes ``bboxes`` and ``labels``
              attributes.
          batch_img_metas (list[dict]): Meta information of each image, e.g.,
              image size, scaling factor, etc.
          batch_gt_instances_ignore (list[:obj:`InstanceData`], optional):
              Batch of gt_instances_ignore. It includes ``bboxes`` attribute
              data that is ignored during training and testing.
              Defaults to None.
          stage (str): 'init' or 'refine'. Generate target for init stage or
              refine stage.
          unmap_outputs (bool): Whether to map outputs back to the original
              set of anchors.
          return_sampling_results (bool): Whether to return the sampling
              results. Defaults to False.
  
      Returns:
          tuple:
  
              - labels_list (list[Tensor]): Labels of each level.
              - label_weights_list (list[Tensor]): Label weights of each
                level.
              - bbox_gt_list (list[Tensor]): Ground truth bbox of each level.
              - proposals_list (list[Tensor]): Proposals(points/bboxes) of
                each level.
              - proposal_weights_list (list[Tensor]): Proposal weights of
                each level.
              - avg_factor (int): Average factor that is used to average
                the loss. When using sampling method, avg_factor is usually
                the sum of positive and negative priors. When using
                `PseudoSampler`, `avg_factor` is usually equal to the number
                of positive priors.
      """
      assert stage in ["init", "refine"]
      num_imgs = len(batch_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])
  
      if batch_gt_instances_ignore is None:
          batch_gt_instances_ignore = [None] * num_imgs
  
      (
          all_labels,
          all_label_weights,
          all_bbox_gt,
          all_proposals,
          all_proposal_weights,
          pos_inds_list,
          neg_inds_list,
          sampling_results_list,
      ) = multi_apply(
          self._get_targets_single,
          proposals_list,
          valid_flag_list,
          batch_gt_instances,
          batch_gt_instances_ignore,
          stage=stage,
          unmap_outputs=unmap_outputs,
      )
  
      # sampled points of all images
      avg_refactor = sum(
          [results.avg_factor for results in sampling_results_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
      )
      res = (
          labels_list,
          label_weights_list,
          bbox_gt_list,
          proposals_list,
          proposal_weights_list,
          avg_refactor,
      )
      if return_sampling_results:
          res = res + (sampling_results_list,)
  
      return res
  
imports: from typing import Dict, List, Sequence, Tuple
  import numpy
  import torch
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmcv.ops import DeformConv2d
  from mmengine.config import ConfigDict
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.utils import ConfigType, InstanceList, MultiConfig, OptInstanceList
  from ..task_modules.prior_generators import MlvlPointGenerator
  from ..task_modules.samplers import PseudoSampler
  from ..utils import filter_scores_and_topk, images_to_levels, multi_apply, unmap
  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.get_targets(proposals_list, valid_flag_list, batch_gt_instances, batch_img_metas, batch_gt_instances_ignore, stage, unmap_outputs, return_sampling_results) and returns: res