docstr: Compute regression, classification and centerness targets for points
  in multiple images.
  
  Args:
      points (list[Tensor]): Points of each fpn level, each has shape
          (num_points, 2).
      data_samples: Batch of data samples. Each data sample contains
          a gt_instance, which usually includes bboxes and labels
          attributes.
  
  Returns:
      tuple: Targets of each level.
  
      - concat_lvl_labels (list[Tensor]): Labels of each level.
      - concat_lvl_bbox_targets (list[Tensor]): BBox targets of each             level.
docstr_tok: ["Compute","regression",",","classification","and","centerness","targets","for","points","in","multiple","images",".","Args",":","points","(","list","[","Tensor","]",")",":","Points","of","each","fpn","level",",","each","has","shape","(","num_points",",","2",")",".","data_samples",":","Batch","of","data","samples",".","Each","data","sample","contains","a","gt_instance",",","which","usually","includes","bboxes","and","labels","attributes",".","Returns",":","tuple",":","Targets","of","each","level",".","-","concat_lvl_labels","(","list","[","Tensor","]",")",":","Labels","of","each","level",".","-","concat_lvl_bbox_targets","(","list","[","Tensor","]",")",":","BBox","targets","of","each","level","."]
code: def get_targets(
      self, points: List[Tensor], data_samples: DetSampleList
  ) -> Tuple[List[Tensor], List[Tensor]]:
      """Compute regression, classification and centerness targets for points
          in multiple images.
  
          Args:
              points (list[Tensor]): Points of each fpn level, each has shape
                  (num_points, 2).
              data_samples: Batch of data samples. Each data sample contains
                  a gt_instance, which usually includes bboxes and labels
                  attributes.
  
          Returns:
              tuple: Targets of each level.
  
              - concat_lvl_labels (list[Tensor]): Labels of each level.
              - concat_lvl_bbox_targets (list[Tensor]): BBox targets of each \
              level.
          """
      assert len(points) == len(self.regress_ranges)
      num_levels = len(points)
      # expand regress ranges to align with points
      expanded_regress_ranges = [
          points[i]
          .new_tensor(self.regress_ranges[i])[None]
          .expand_as(points[i])
          for i in range(num_levels)
      ]
      # concat all levels points and regress ranges
      concat_regress_ranges = torch.cat(expanded_regress_ranges, dim=0)
      concat_points = torch.cat(points, dim=0)
  
      # the number of points per img, per lvl
      num_points = [center.size(0) for center in points]
  
      # get labels and bbox_targets of each image
      labels_list, bbox_targets_list, bezier_targets_list = multi_apply(
          self._get_targets_single,
          data_samples,
          points=concat_points,
          regress_ranges=concat_regress_ranges,
          num_points_per_lvl=num_points,
      )
  
      # split to per img, per level
      labels_list = [
          labels.split(num_points, 0) for labels in labels_list
      ]
      bbox_targets_list = [
          bbox_targets.split(num_points, 0)
          for bbox_targets in bbox_targets_list
      ]
      bezier_targets_list = [
          bezier_targets.split(num_points, 0)
          for bezier_targets in bezier_targets_list
      ]
      # concat per level image
      concat_lvl_labels = []
      concat_lvl_bbox_targets = []
      concat_lvl_bezier_targets = []
      for i in range(num_levels):
          concat_lvl_labels.append(
              torch.cat([labels[i] for labels in labels_list])
          )
          bbox_targets = torch.cat(
              [bbox_targets[i] for bbox_targets in bbox_targets_list]
          )
          bezier_targets = torch.cat(
              [
                  bezier_targets[i]
                  for bezier_targets in bezier_targets_list
              ]
          )
          if self.norm_on_bbox:
              bbox_targets = bbox_targets / self.strides[i]
              bezier_targets = bezier_targets / self.strides[i]
          concat_lvl_bbox_targets.append(bbox_targets)
          concat_lvl_bezier_targets.append(bezier_targets)
      return (
          concat_lvl_labels,
          concat_lvl_bbox_targets,
          concat_lvl_bezier_targets,
      )
  
file_path: mmocr/projects/ABCNet/abcnet/model/abcnet_det_module_loss.py
imports: from typing import Dict, List, Tuple
  import torch
  from mmdet.models.task_modules.prior_generators import MlvlPointGenerator
  from mmdet.models.utils import multi_apply
  from mmdet.utils import reduce_mean
  from torch import Tensor
  from mmocr.models.textdet.module_losses.base import BaseTextDetModuleLoss
  from mmocr.registry import MODELS, TASK_UTILS
  from mmocr.structures import TextDetDataSample
  from mmocr.utils import ConfigType, DetSampleList, RangeType
  from ..utils import poly2bezier
label_desc: Use image node_id 3 for calling the ABCNetDetModuleLoss obj's underlying member method code with example usage: obj.get_targets(points, data_samples) and returns: concat_lvl_labels,  concat_lvl_bbox_targets,  concat_lvl_bezier_targets