code: def retinanet(
      inputs,
      backbone_layers,
      num_classes,
      num_anchors=None,
      create_pyramid_features=__create_pyramid_features,
      pyramid_levels=None,
      submodels=None,
      name="retinanet",
  ):
      """Construct a RetinaNet model on top of a backbone.
  
      This model is the minimum model necessary for training (with the unfortunate exception of anchors as output).
  
      Args
          inputs                  : keras.layers.Input (or list of) for the input to the model.
          num_classes             : Number of classes to classify.
          num_anchors             : Number of base anchors.
          create_pyramid_features : Functor for creating pyramid features given the features C3, C4, C5, and possibly C2 from the backbone.
          pyramid_levels          : pyramid levels to use.
          submodels               : Submodels to run on each feature map (default is regression and classification submodels).
          name                    : Name of the model.
  
      Returns
          A keras.models.Model which takes an image as input and outputs generated anchors and the result from each submodel on every pyramid level.
  
          The order of the outputs is as defined in submodels:
          ```
          [
              regression, classification, other[0], other[1], ...
          ]
          ```
      """
  
      if num_anchors is None:
          num_anchors = AnchorParameters.default.num_anchors()
  
      if submodels is None:
          submodels = default_submodels(num_classes, num_anchors)
  
      if pyramid_levels is None:
          pyramid_levels = [3, 4, 5, 6, 7]
  
      if 2 in pyramid_levels and "C2" not in backbone_layers:
          raise ValueError(
              "C2 not provided by backbone model. Cannot create P2 layers."
          )
  
      if (
          3 not in pyramid_levels
          or 4 not in pyramid_levels
          or 5 not in pyramid_levels
      ):
          raise ValueError(
              "pyramid levels 3, 4, and 5 required for functionality"
          )
  
      # compute pyramid features as per https://arxiv.org/abs/1708.02002
      features = create_pyramid_features(
          backbone_layers, pyramid_levels
      )
      feature_list = [features["P{}".format(p)] for p in pyramid_levels]
  
      # for all pyramid levels, run available submodels
      pyramids = __build_pyramid(submodels, feature_list)
  
      return keras.models.Model(
          inputs=inputs, outputs=pyramids, name=name
      )
  
file_path: ImageAI/imageai_tf_deprecated/Detection/keras_retinanet/models/retinanet.py
imports: from tensorflow import keras
  from ..None import initializers
  from ..None import layers
  from ..utils.anchors import AnchorParameters
  from .None import assert_training_model
label_desc: Use image node_id 8 for calling a global function with example usage: retinanet(inputs, backbone_layers, num_classes, num_anchors, create_pyramid_features, pyramid_levels, submodels, name) and returns: keras