class_docstr: Anchor-free head used in `FSAF <https://arxiv.org/abs/1903.00621>`_.
  
  The head contains two subnetworks. The first classifies anchor boxes and
  the second regresses deltas for the anchors (num_anchors is 1 for anchor-
  free methods)
  
  Args:
      *args: Same as its base class in :class:`RetinaHead`
      score_threshold (float, optional): The score_threshold to calculate
          positive recall. If given, prediction scores lower than this value
          is counted as incorrect prediction. Default to None.
      **kwargs: Same as its base class in :class:`RetinaHead`
  
  Example:
      >>> import torch
      >>> self = FSAFHead(11, 7)
      >>> x = torch.rand(1, 7, 32, 32)
      >>> cls_score, bbox_pred = self.forward_single(x)
      >>> # Each anchor predicts a score for each class except background
      >>> cls_per_anchor = cls_score.shape[1] / self.num_anchors
      >>> box_per_anchor = bbox_pred.shape[1] / self.num_anchors
      >>> assert cls_per_anchor == self.num_classes
      >>> assert box_per_anchor == 4
class_docstr_tok: ["Anchor-free","head","used","in","`","FSAF","<","https",":","\/\/arxiv.org\/abs\/1903.00621",">","`","_",".","The","head","contains","two","subnetworks",".","The","first","classifies","anchor","boxes","and","the","second","regresses","deltas","for","the","anchors","(","num_anchors","is","1","for","anchor-","free","methods",")","Args",":","*","args",":","Same","as","its","base","class","in",":","class",":","`","RetinaHead","`","score_threshold","(","float",",","optional",")",":","The","score_threshold","to","calculate","positive","recall",".","If","given",",","prediction","scores","lower","than","this","value","is","counted","as","incorrect","prediction",".","Default","to","None",".","*","*","kwargs",":","Same","as","its","base","class","in",":","class",":","`","RetinaHead","`","Example",":",">",">",">","import","torch",">",">",">","self","=","FSAFHead","(","11",",","7",")",">",">",">","x","=","torch.rand","(","1",",","7",",","32",",","32",")",">",">",">","cls_score",",","bbox_pred","=","self.forward_single","(","x",")",">",">",">","#","Each","anchor","predicts","a","score","for","each","class","except","background",">",">",">","cls_per_anchor","=","cls_score.shape","[","1","]","\/","self.num_anchors",">",">",">","box_per_anchor","=","bbox_pred.shape","[","1","]","\/","self.num_anchors",">",">",">","assert","cls_per_anchor","==","self.num_classes",">",">",">","assert","box_per_anchor","==","4"]
docstr: Forward feature map of a single scale level.
  
  Args:
      x (Tensor): Feature map of a single scale level.
  
  Returns:
      tuple (Tensor):
          cls_score (Tensor): Box scores for each scale level
              Has shape (N, num_points * num_classes, H, W).
          bbox_pred (Tensor): Box energies / deltas for each scale
              level with shape (N, num_points * 4, H, W).
docstr_tok: ["Forward","feature","map","of","a","single","scale","level",".","Args",":","x","(","Tensor",")",":","Feature","map","of","a","single","scale","level",".","Returns",":","tuple","(","Tensor",")",":","cls_score","(","Tensor",")",":","Box","scores","for","each","scale","level","Has","shape","(","N",",","num_points","*","num_classes",",","H",",","W",")",".","bbox_pred","(","Tensor",")",":","Box","energies","\/","deltas","for","each","scale","level","with","shape","(","N",",","num_points","*","4",",","H",",","W",")","."]
code: def forward_single(self, x):
      """Forward feature map of a single scale level.
  
      Args:
          x (Tensor): Feature map of a single scale level.
  
      Returns:
          tuple (Tensor):
              cls_score (Tensor): Box scores for each scale level
                  Has shape (N, num_points * num_classes, H, W).
              bbox_pred (Tensor): Box energies / deltas for each scale
                  level with shape (N, num_points * 4, H, W).
      """
      cls_score, bbox_pred = super().forward_single(x)
      # relu: TBLR encoder only accepts positive bbox_pred
      return cls_score, self.relu(bbox_pred)
  
file_path: insightface/detection/scrfd/mmdet/models/dense_heads/fsaf_head.py
imports: import numpy
  import torch
  from mmcv.cnn import normal_init
  from mmcv.runner import force_fp32
  from mmdet.core import anchor_inside_flags, images_to_levels, multi_apply, unmap
  from ..builder import HEADS
  from ..losses.accuracy import accuracy
  from ..losses.utils import weight_reduce_loss
  from .retina_head import RetinaHead
label_desc: Use image node_id 2 for calling the FSAFHead obj's underlying member method code with example usage: obj.forward_single(x) and returns: cls_score,  self