code: def densenet_retinanet(
      num_classes,
      backbone="densenet121",
      inputs=None,
      modifier=None,
      **kwargs,
  ):
      """Constructs a retinanet model using a densenet backbone.
  
      Args
          num_classes: Number of classes to predict.
          backbone: Which backbone to use (one of ('densenet121', 'densenet169', 'densenet201')).
          inputs: The inputs to the network (defaults to a Tensor of shape (None, None, 3)).
          modifier: A function handler which can modify the backbone before using it in retinanet (this can be used to freeze backbone layers for example).
  
      Returns
          RetinaNet model with a DenseNet backbone.
      """
      # choose default input
      if inputs is None:
          inputs = keras.layers.Input((None, None, 3))
  
      blocks, creator = allowed_backbones[backbone]
      model = creator(
          input_tensor=inputs,
          include_top=False,
          pooling=None,
          weights=None,
      )
  
      # get last conv layer from the end of each dense block
      layer_outputs = [
          model.get_layer(
              name="conv{}_block{}_concat".format(idx + 2, block_num)
          ).output
          for idx, block_num in enumerate(blocks)
      ]
  
      # create the densenet backbone
      # layer_outputs contains 4 layers
      model = keras.models.Model(
          inputs=inputs, outputs=layer_outputs, name=model.name
      )
  
      # invoke modifier if given
      if modifier:
          model = modifier(model)
  
      # create the full model
      backbone_layers = {
          "C2": model.outputs[0],
          "C3": model.outputs[1],
          "C4": model.outputs[2],
          "C5": model.outputs[3],
      }
  
      model = retinanet.retinanet(
          inputs=inputs,
          num_classes=num_classes,
          backbone_layers=backbone_layers,
          **kwargs,
      )
  
      return model
  
file_path: ImageAI/imageai_tf_deprecated/Detection/keras_retinanet/models/densenet.py
imports: from tensorflow import keras
  from .None import retinanet
  from .None import Backbone
  from ..utils.image import preprocess_image
label_desc: Use image node_id 1 for calling a global function with example usage: densenet_retinanet(num_classes, backbone, inputs, modifier) and returns: model