class_docstr: YOLOV3Head Paper link: https://arxiv.org/abs/1804.02767.
  
  Args:
      num_classes (int): The number of object classes (w/o background)
      in_channels (List[int]): Number of input channels per scale.
      out_channels (List[int]): The number of output channels per scale
          before the final 1x1 layer. Default: (1024, 512, 256).
      anchor_generator (dict): Config dict for anchor generator
      bbox_coder (dict): Config of bounding box coder.
      featmap_strides (List[int]): The stride of each scale.
          Should be in descending order. Default: (32, 16, 8).
      one_hot_smoother (float): Set a non-zero value to enable label-smooth
          Default: 0.
      conv_cfg (dict): Config dict for convolution layer. Default: None.
      norm_cfg (dict): Dictionary to construct and config norm layer.
          Default: dict(type='BN', requires_grad=True)
      act_cfg (dict): Config dict for activation layer.
          Default: dict(type='LeakyReLU', negative_slope=0.1).
      loss_cls (dict): Config of classification loss.
      loss_conf (dict): Config of confidence loss.
      loss_xy (dict): Config of xy coordinate loss.
      loss_wh (dict): Config of wh coordinate loss.
      train_cfg (dict): Training config of YOLOV3 head. Default: None.
      test_cfg (dict): Testing config of YOLOV3 head. Default: None.
class_docstr_tok: ["YOLOV3Head","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1804.02767",".","Args",":","num_classes","(","int",")",":","The","number","of","object","classes","(","w\/o","background",")","in_channels","(","List","[","int","]",")",":","Number","of","input","channels","per","scale",".","out_channels","(","List","[","int","]",")",":","The","number","of","output","channels","per","scale","before","the","final","1x1","layer",".","Default",":","(","1024",",","512",",","256",")",".","anchor_generator","(","dict",")",":","Config","dict","for","anchor","generator","bbox_coder","(","dict",")",":","Config","of","bounding","box","coder",".","featmap_strides","(","List","[","int","]",")",":","The","stride","of","each","scale",".","Should","be","in","descending","order",".","Default",":","(","32",",","16",",","8",")",".","one_hot_smoother","(","float",")",":","Set","a","non-zero","value","to","enable","label-smooth","Default",":","0.","conv_cfg","(","dict",")",":","Config","dict","for","convolution","layer",".","Default",":","None",".","norm_cfg","(","dict",")",":","Dictionary","to","construct","and","config","norm","layer",".","Default",":","dict","(","type='BN","'",",","requires_grad=True",")","act_cfg","(","dict",")",":","Config","dict","for","activation","layer",".","Default",":","dict","(","type='LeakyReLU","'",",","negative_slope=0.1",")",".","loss_cls","(","dict",")",":","Config","of","classification","loss",".","loss_conf","(","dict",")",":","Config","of","confidence","loss",".","loss_xy","(","dict",")",":","Config","of","xy","coordinate","loss",".","loss_wh","(","dict",")",":","Config","of","wh","coordinate","loss",".","train_cfg","(","dict",")",":","Training","config","of","YOLOV3","head",".","Default",":","None",".","test_cfg","(","dict",")",":","Testing","config","of","YOLOV3","head",".","Default",":","None","."]
docstr: Generate matching bounding box prior and converted GT.
  
  Args:
      anchors (list[Tensor]): Multi-level anchors of the image.
      responsible_flags (list[Tensor]): Multi-level responsible flags of
          anchors
      gt_bboxes (Tensor): Ground truth bboxes of single image.
      gt_labels (Tensor): Ground truth labels of single image.
  
  Returns:
      tuple:
          target_map (Tensor): Predication target map of each
              scale level, shape (num_total_anchors,
              5+num_classes)
          neg_map (Tensor): Negative map of each scale level,
              shape (num_total_anchors,)
docstr_tok: ["Generate","matching","bounding","box","prior","and","converted","GT",".","Args",":","anchors","(","list","[","Tensor","]",")",":","Multi-level","anchors","of","the","image",".","responsible_flags","(","list","[","Tensor","]",")",":","Multi-level","responsible","flags","of","anchors","gt_bboxes","(","Tensor",")",":","Ground","truth","bboxes","of","single","image",".","gt_labels","(","Tensor",")",":","Ground","truth","labels","of","single","image",".","Returns",":","tuple",":","target_map","(","Tensor",")",":","Predication","target","map","of","each","scale","level",",","shape","(","num_total_anchors",",","5+num_classes",")","neg_map","(","Tensor",")",":","Negative","map","of","each","scale","level",",","shape","(","num_total_anchors",",",")"]
code: def _get_targets_single(
      self, anchors, responsible_flags, gt_bboxes, gt_labels
  ):
      """Generate matching bounding box prior and converted GT.
  
      Args:
          anchors (list[Tensor]): Multi-level anchors of the image.
          responsible_flags (list[Tensor]): Multi-level responsible flags of
              anchors
          gt_bboxes (Tensor): Ground truth bboxes of single image.
          gt_labels (Tensor): Ground truth labels of single image.
  
      Returns:
          tuple:
              target_map (Tensor): Predication target map of each
                  scale level, shape (num_total_anchors,
                  5+num_classes)
              neg_map (Tensor): Negative map of each scale level,
                  shape (num_total_anchors,)
      """
  
      anchor_strides = []
      for i in range(len(anchors)):
          anchor_strides.append(
              torch.tensor(
                  self.featmap_strides[i], device=gt_bboxes.device
              ).repeat(len(anchors[i]))
          )
      concat_anchors = torch.cat(anchors)
      concat_responsible_flags = torch.cat(responsible_flags)
  
      anchor_strides = torch.cat(anchor_strides)
      assert (
          len(anchor_strides)
          == len(concat_anchors)
          == len(concat_responsible_flags)
      )
      assign_result = self.assigner.assign(
          concat_anchors, concat_responsible_flags, gt_bboxes
      )
      sampling_result = self.sampler.sample(
          assign_result, concat_anchors, gt_bboxes
      )
  
      target_map = concat_anchors.new_zeros(
          concat_anchors.size(0), self.num_attrib
      )
  
      target_map[sampling_result.pos_inds, :4] = self.bbox_coder.encode(
          sampling_result.pos_bboxes,
          sampling_result.pos_gt_bboxes,
          anchor_strides[sampling_result.pos_inds],
      )
  
      target_map[sampling_result.pos_inds, 4] = 1
  
      gt_labels_one_hot = F.one_hot(
          gt_labels, num_classes=self.num_classes
      ).float()
      if self.one_hot_smoother != 0:  # label smooth
          gt_labels_one_hot = (
              gt_labels_one_hot * (1 - self.one_hot_smoother)
              + self.one_hot_smoother / self.num_classes
          )
      target_map[sampling_result.pos_inds, 5:] = gt_labels_one_hot[
          sampling_result.pos_assigned_gt_inds
      ]
  
      neg_map = concat_anchors.new_zeros(
          concat_anchors.size(0), dtype=torch.uint8
      )
      neg_map[sampling_result.neg_inds] = 1
  
      return target_map, neg_map
  
imports: import warnings
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, normal_init
  from mmcv.runner import force_fp32
  from mmdet.core import build_anchor_generator, build_assigner, build_bbox_coder, build_sampler, images_to_levels, multi_apply, multiclass_nms
  from ..builder import HEADS, build_loss
  from .base_dense_head import BaseDenseHead
  from .dense_test_mixins import BBoxTestMixin
label_desc: Use image node_id 12 for calling the YOLOV3Head obj's underlying member method code with example usage: obj._get_targets_single(anchors, responsible_flags, gt_bboxes, gt_labels) and returns: target_map,  neg_map