docstr: Compute centerness targets.
  
  Args:
      pos_bbox_targets (Tensor): BBox targets of positive bboxes in shape
          (num_pos, 4)
  
  Returns:
      Tensor: Centerness target.
docstr_tok: ["Compute","centerness","targets",".","Args",":","pos_bbox_targets","(","Tensor",")",":","BBox","targets","of","positive","bboxes","in","shape","(","num_pos",",","4",")","Returns",":","Tensor",":","Centerness","target","."]
code: def centerness_target(self, pos_bbox_targets: Tensor) -> Tensor:
      """Compute centerness targets.
  
      Args:
          pos_bbox_targets (Tensor): BBox targets of positive bboxes in shape
              (num_pos, 4)
  
      Returns:
          Tensor: Centerness target.
      """
      # only calculate pos centerness targets, otherwise there may be nan
      left_right = pos_bbox_targets[:, [0, 2]]
      top_bottom = pos_bbox_targets[:, [1, 3]]
      if len(left_right) == 0:
          centerness_targets = left_right[..., 0]
      else:
          centerness_targets = (
              left_right.min(dim=-1)[0] / left_right.max(dim=-1)[0]
          ) * (top_bottom.min(dim=-1)[0] / top_bottom.max(dim=-1)[0])
      return torch.sqrt(centerness_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 5 for calling the ABCNetDetModuleLoss obj's underlying member method code with example usage: obj.centerness_target(pos_bbox_targets) and returns: torch