class_docstr: Objects as Points Head. CenterHead use center_point to indicate object's
  position. Paper link <https://arxiv.org/abs/1904.07850>
  
  Args:
      in_channels (int): Number of channel in the input feature map.
      feat_channels (int): Number of channel in the intermediate feature map.
      num_classes (int): Number of categories excluding the background
          category.
      loss_center_heatmap (:obj:`ConfigDict` or dict): Config of center
          heatmap loss. Defaults to
          dict(type='GaussianFocalLoss', loss_weight=1.0)
      loss_wh (:obj:`ConfigDict` or dict): Config of wh loss. Defaults to
           dict(type='L1Loss', loss_weight=0.1).
      loss_offset (:obj:`ConfigDict` or dict): Config of offset loss.
          Defaults to dict(type='L1Loss', loss_weight=1.0).
      train_cfg (:obj:`ConfigDict` or dict, optional): Training config.
          Useless in CenterNet, but we keep this variable for
          SingleStageDetector.
      test_cfg (:obj:`ConfigDict` or dict, optional): Testing config
          of CenterNet.
      init_cfg (:obj:`ConfigDict` or dict or list[dict] or
          list[:obj:`ConfigDict`], optional): Initialization
          config dict.
docstr: Compute regression and classification targets in multiple images.
  
  Args:
      gt_bboxes (list[Tensor]): Ground truth bboxes for each image with
          shape (num_gts, 4) in [tl_x, tl_y, br_x, br_y] format.
      gt_labels (list[Tensor]): class indices corresponding to each box.
      feat_shape (tuple): feature map shape with value [B, _, H, W]
      img_shape (tuple): image shape.
  
  Returns:
      tuple[dict, float]: The float value is mean avg_factor, the dict
      has components below:
         - center_heatmap_target (Tensor): targets of center heatmap,                    shape (B, num_classes, H, W).
         - wh_target (Tensor): targets of wh predict, shape                    (B, 2, H, W).
         - offset_target (Tensor): targets of offset predict, shape                    (B, 2, H, W).
         - wh_offset_target_weight (Tensor): weights of wh and offset                    predict, shape (B, 2, H, W).
docstr_tok: ["Compute","regression","and","classification","targets","in","multiple","images",".","Args",":","gt_bboxes","(","list","[","Tensor","]",")",":","Ground","truth","bboxes","for","each","image","with","shape","(","num_gts",",","4",")","in","[","tl_x",",","tl_y",",","br_x",",","br_y","]","format",".","gt_labels","(","list","[","Tensor","]",")",":","class","indices","corresponding","to","each","box",".","feat_shape","(","tuple",")",":","feature","map","shape","with","value","[","B",",","_",",","H",",","W","]","img_shape","(","tuple",")",":","image","shape",".","Returns",":","tuple","[","dict",",","float","]",":","The","float","value","is","mean","avg_factor",",","the","dict","has","components","below",":","-","center_heatmap_target","(","Tensor",")",":","targets","of","center","heatmap",",","shape","(","B",",","num_classes",",","H",",","W",")",".","-","wh_target","(","Tensor",")",":","targets","of","wh","predict",",","shape","(","B",",","2",",","H",",","W",")",".","-","offset_target","(","Tensor",")",":","targets","of","offset","predict",",","shape","(","B",",","2",",","H",",","W",")",".","-","wh_offset_target_weight","(","Tensor",")",":","weights","of","wh","and","offset","predict",",","shape","(","B",",","2",",","H",",","W",")","."]
code: def get_targets(
      self,
      gt_bboxes: List[Tensor],
      gt_labels: List[Tensor],
      feat_shape: tuple,
      img_shape: tuple,
  ) -> Tuple[dict, int]:
      """Compute regression and classification targets in multiple images.
  
          Args:
              gt_bboxes (list[Tensor]): Ground truth bboxes for each image with
                  shape (num_gts, 4) in [tl_x, tl_y, br_x, br_y] format.
              gt_labels (list[Tensor]): class indices corresponding to each box.
              feat_shape (tuple): feature map shape with value [B, _, H, W]
              img_shape (tuple): image shape.
  
          Returns:
              tuple[dict, float]: The float value is mean avg_factor, the dict
              has components below:
                 - center_heatmap_target (Tensor): targets of center heatmap, \
                     shape (B, num_classes, H, W).
                 - wh_target (Tensor): targets of wh predict, shape \
                     (B, 2, H, W).
                 - offset_target (Tensor): targets of offset predict, shape \
                     (B, 2, H, W).
                 - wh_offset_target_weight (Tensor): weights of wh and offset \
                     predict, shape (B, 2, H, W).
          """
      img_h, img_w = img_shape[:2]
      bs, _, feat_h, feat_w = feat_shape
  
      width_ratio = float(feat_w / img_w)
      height_ratio = float(feat_h / img_h)
  
      center_heatmap_target = gt_bboxes[-1].new_zeros(
          [bs, self.num_classes, feat_h, feat_w]
      )
      wh_target = gt_bboxes[-1].new_zeros([bs, 2, feat_h, feat_w])
      offset_target = gt_bboxes[-1].new_zeros([bs, 2, feat_h, feat_w])
      wh_offset_target_weight = gt_bboxes[-1].new_zeros(
          [bs, 2, feat_h, feat_w]
      )
  
      for batch_id in range(bs):
          gt_bbox = gt_bboxes[batch_id]
          gt_label = gt_labels[batch_id]
          center_x = (
              (gt_bbox[:, [0]] + gt_bbox[:, [2]]) * width_ratio / 2
          )
          center_y = (
              (gt_bbox[:, [1]] + gt_bbox[:, [3]]) * height_ratio / 2
          )
          gt_centers = torch.cat((center_x, center_y), dim=1)
  
          for j, ct in enumerate(gt_centers):
              ctx_int, cty_int = ct.int()
              ctx, cty = ct
              scale_box_h = (
                  gt_bbox[j][3] - gt_bbox[j][1]
              ) * height_ratio
              scale_box_w = (
                  gt_bbox[j][2] - gt_bbox[j][0]
              ) * width_ratio
              radius = gaussian_radius(
                  [scale_box_h, scale_box_w], min_overlap=0.3
              )
              radius = max(0, int(radius))
              ind = gt_label[j]
              gen_gaussian_target(
                  center_heatmap_target[batch_id, ind],
                  [ctx_int, cty_int],
                  radius,
              )
  
              wh_target[batch_id, 0, cty_int, ctx_int] = scale_box_w
              wh_target[batch_id, 1, cty_int, ctx_int] = scale_box_h
  
              offset_target[batch_id, 0, cty_int, ctx_int] = (
                  ctx - ctx_int
              )
              offset_target[batch_id, 1, cty_int, ctx_int] = (
                  cty - cty_int
              )
  
              wh_offset_target_weight[batch_id, :, cty_int, ctx_int] = 1
  
      avg_factor = max(1, center_heatmap_target.eq(1).sum())
      target_result = dict(
          center_heatmap_target=center_heatmap_target,
          wh_target=wh_target,
          offset_target=offset_target,
          wh_offset_target_weight=wh_offset_target_weight,
      )
      return target_result, avg_factor
  
imports: from typing import List, Optional, Tuple
  import torch
  import torch.nn
  from mmcv.ops import batched_nms
  from mmengine.config import ConfigDict
  from mmengine.model import bias_init_with_prob, normal_init
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.utils import ConfigType, InstanceList, OptConfigType, OptInstanceList, OptMultiConfig
  from ..utils import gaussian_radius, gen_gaussian_target, get_local_maximum, get_topk_from_heatmap, multi_apply, transpose_and_gather_feat
  from .base_dense_head import BaseDenseHead
label_desc: Use image node_id 7 for calling the CenterNetHead obj's underlying member method code with example usage: obj.get_targets(gt_bboxes, gt_labels, feat_shape, img_shape) and returns: target_result,  avg_factor