class_docstr: Bridging the Gap Between Anchor-based and Anchor-free Detection via
  Adaptive Training Sample Selection.
  
  ATSS head structure is similar with FCOS, however ATSS use anchor boxes
  and assign label by Adaptive Training Sample Selection instead max-iou.
  
  https://arxiv.org/abs/1912.02424
class_docstr_tok: ["Bridging","the","Gap","Between","Anchor-based","and","Anchor-free","Detection","via","Adaptive","Training","Sample","Selection",".","ATSS","head","structure","is","similar","with","FCOS",",","however","ATSS","use","anchor","boxes","and","assign","label","by","Adaptive","Training","Sample","Selection","instead","max-iou",".","https",":","\/\/arxiv.org\/abs\/1912.02424"]
code: def centerness_target(self, anchors, bbox_targets):
      # only calculate pos centerness targets, otherwise there may be nan
      gts = self.bbox_coder.decode(anchors, bbox_targets)
      anchors_cx = (anchors[:, 2] + anchors[:, 0]) / 2
      anchors_cy = (anchors[:, 3] + anchors[:, 1]) / 2
      l_ = anchors_cx - gts[:, 0]
      t_ = anchors_cy - gts[:, 1]
      r_ = gts[:, 2] - anchors_cx
      b_ = gts[:, 3] - anchors_cy
  
      left_right = torch.stack([l_, r_], dim=1)
      top_bottom = torch.stack([t_, b_], dim=1)
      centerness = torch.sqrt(
          (left_right.min(dim=-1)[0] / left_right.max(dim=-1)[0])
          * (top_bottom.min(dim=-1)[0] / top_bottom.max(dim=-1)[0])
      )
      assert not torch.isnan(centerness).any()
      return centerness
  
imports: import torch
  import torch.nn
  from mmcv.cnn import ConvModule, Scale, bias_init_with_prob, normal_init
  from mmcv.runner import force_fp32
  from mmdet.core import anchor_inside_flags, build_assigner, build_sampler, images_to_levels, multi_apply, multiclass_nms, reduce_mean, unmap
  from ..builder import HEADS, build_loss
  from .anchor_head import AnchorHead
label_desc: Use image node_id 8 for calling the ATSSHead obj's underlying member method code with example usage: obj.centerness_target(anchors, bbox_targets) and returns: centerness