code: def mobilenet_retinanet(
      num_classes,
      backbone="mobilenet224_1.0",
      inputs=None,
      modifier=None,
      **kwargs,
  ):
      """Constructs a retinanet model using a mobilenet backbone.
  
      Args
          num_classes: Number of classes to predict.
          backbone: Which backbone to use (one of ('mobilenet128', 'mobilenet160', 'mobilenet192', 'mobilenet224')).
          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 MobileNet backbone.
      """
      alpha = float(backbone.split("_")[1])
  
      # choose default input
      if inputs is None:
          inputs = keras.layers.Input((None, None, 3))
  
      backbone = keras.applications.mobilenet.MobileNet(
          input_tensor=inputs,
          alpha=alpha,
          include_top=False,
          pooling=None,
          weights=None,
      )
  
      # create the full model
      layer_names = [
          "conv_pw_5_relu",
          "conv_pw_11_relu",
          "conv_pw_13_relu",
      ]
      layer_outputs = [
          backbone.get_layer(name).output for name in layer_names
      ]
      backbone = keras.models.Model(
          inputs=inputs, outputs=layer_outputs, name=backbone.name
      )
  
      # invoke modifier if given
      if modifier:
          backbone = modifier(backbone)
  
      # C2 not provided
      backbone_layers = {
          "C3": backbone.outputs[0],
          "C4": backbone.outputs[1],
          "C5": backbone.outputs[2],
      }
  
      return retinanet.retinanet(
          inputs=inputs,
          num_classes=num_classes,
          backbone_layers=backbone_layers,
          **kwargs,
      )
  
file_path: ImageAI/imageai_tf_deprecated/Detection/keras_retinanet/models/mobilenet.py
imports: from tensorflow import keras
  from ..utils.image import preprocess_image
  from .None import retinanet
  from .None import Backbone
label_desc: Use image node_id 1 for calling a global function with example usage: mobilenet_retinanet(num_classes, backbone, inputs, modifier) and returns: retinanet