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. Defaults to None.
      init_cfg (:obj:`ConfigDict` or dict or list[:obj:`ConfigDict` or             dict]): Initialization config dict.
      **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",".","Defaults","to","None",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict","or","list","[",":","obj",":","`","ConfigDict","`","or","dict","]",")",":","Initialization","config","dict",".","*","*","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: Calculate positive recall with score threshold.
  
  Args:
      cls_scores (list[Tensor]): Classification scores at all fpn levels.
          Each tensor is in shape (N, num_classes * num_anchors, H, W)
      labels_list (list[Tensor]): The label that each anchor is assigned
          to. Shape (N * H * W * num_anchors, )
      pos_inds (list[Tensor]): List of bool tensors indicating whether
          the anchor is assigned to a positive label.
          Shape (N * H * W * num_anchors, )
  
  Returns:
      Tensor: A single float number indicating the positive recall.
docstr_tok: ["Calculate","positive","recall","with","score","threshold",".","Args",":","cls_scores","(","list","[","Tensor","]",")",":","Classification","scores","at","all","fpn","levels",".","Each","tensor","is","in","shape","(","N",",","num_classes","*","num_anchors",",","H",",","W",")","labels_list","(","list","[","Tensor","]",")",":","The","label","that","each","anchor","is","assigned","to",".","Shape","(","N","*","H","*","W","*","num_anchors",",",")","pos_inds","(","list","[","Tensor","]",")",":","List","of","bool","tensors","indicating","whether","the","anchor","is","assigned","to","a","positive","label",".","Shape","(","N","*","H","*","W","*","num_anchors",",",")","Returns",":","Tensor",":","A","single","float","number","indicating","the","positive","recall","."]
code: def calculate_pos_recall(
      self,
      cls_scores: List[Tensor],
      labels_list: List[Tensor],
      pos_inds: List[Tensor],
  ) -> Tensor:
      """Calculate positive recall with score threshold.
  
      Args:
          cls_scores (list[Tensor]): Classification scores at all fpn levels.
              Each tensor is in shape (N, num_classes * num_anchors, H, W)
          labels_list (list[Tensor]): The label that each anchor is assigned
              to. Shape (N * H * W * num_anchors, )
          pos_inds (list[Tensor]): List of bool tensors indicating whether
              the anchor is assigned to a positive label.
              Shape (N * H * W * num_anchors, )
  
      Returns:
          Tensor: A single float number indicating the positive recall.
      """
      with torch.no_grad():
          num_class = self.num_classes
          scores = [
              cls.permute(0, 2, 3, 1).reshape(-1, num_class)[pos]
              for cls, pos in zip(cls_scores, pos_inds)
          ]
          labels = [
              label.reshape(-1)[pos]
              for label, pos in zip(labels_list, pos_inds)
          ]
          scores = torch.cat(scores, dim=0)
          labels = torch.cat(labels, dim=0)
          if self.use_sigmoid_cls:
              scores = scores.sigmoid()
          else:
              scores = scores.softmax(dim=1)
  
          return accuracy(scores, labels, thresh=self.score_threshold)
  
imports: from typing import Dict, List, Optional, Tuple
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.utils import InstanceList, OptInstanceList, OptMultiConfig
  from ..losses.accuracy import accuracy
  from ..losses.utils import weight_reduce_loss
  from ..task_modules.prior_generators import anchor_inside_flags
  from ..utils import images_to_levels, multi_apply, unmap
  from .retina_head import RetinaHead
label_desc: Use image node_id 5 for calling the FSAFHead obj's underlying member method code with example usage: obj.calculate_pos_recall(cls_scores, labels_list, pos_inds) and returns: accuracy