class_docstr: The head used in RetinaNet for object classification and box regression.
  It has two subnets for the two tasks, with a common structure but separate parameters.
class_docstr_tok: ["The","head","used","in","RetinaNet","for","object","classification","and","box","regression",".","It","has","two","subnets","for","the","two","tasks",",","with","a","common","structure","but","separate","parameters","."]
code: def from_config(cls, cfg, input_shape: List[ShapeSpec]):
      num_anchors = build_anchor_generator(
          cfg, input_shape
      ).num_cell_anchors
      assert (
          len(set(num_anchors)) == 1
      ), "Using different number of anchors between levels is not currently supported!"
      num_anchors = num_anchors[0]
  
      return {
          "input_shape": input_shape,
          "num_classes": cfg.MODEL.RETINANET.NUM_CLASSES,
          "conv_dims": [input_shape[0].channels]
          * cfg.MODEL.RETINANET.NUM_CONVS,
          "prior_prob": cfg.MODEL.RETINANET.PRIOR_PROB,
          "norm": cfg.MODEL.RETINANET.NORM,
          "num_anchors": num_anchors,
      }
  
imports: import logging
  import math
  from typing import List, Tuple
  import torch
  from fvcore.nn import sigmoid_focal_loss_jit
  from torch import Tensor, nn
  from torch.nn import functional
  from detectron2.config import configurable
  from detectron2.layers import CycleBatchNormList, ShapeSpec, batched_nms, cat, get_norm
  from detectron2.structures import Boxes, ImageList, Instances, pairwise_iou
  from detectron2.utils.events import get_event_storage
  from ..anchor_generator import build_anchor_generator
  from ..backbone import Backbone, build_backbone
  from ..box_regression import Box2BoxTransform, _dense_box_regression_loss
  from ..matcher import Matcher
  from .build import META_ARCH_REGISTRY
  from .dense_detector import DenseDetector, permute_to_N_HWA_K
label_desc: Use image node_id 2 for calling the RetinaNetHead obj's underlying member method code with example usage: obj.from_config(cls, cfg, input_shape) and returns: dict