code: def create_models(
      backbone_retinanet,
      num_classes,
      weights,
      multi_gpu=0,
      freeze_backbone=False,
      lr=1e-5,
      optimizer_clipnorm=0.001,
      config=None,
  ):
      """Creates three models (model, training_model, prediction_model).
  
      Args
          backbone_retinanet : A function to call to create a retinanet model with a given backbone.
          num_classes        : The number of classes to train.
          weights            : The weights to load into the model.
          multi_gpu          : The number of GPUs to use for training.
          freeze_backbone    : If True, disables learning for the backbone.
          config             : Config parameters, None indicates the default configuration.
  
      Returns
          model            : The base model. This is also the model that is saved in snapshots.
          training_model   : The training model. If multi_gpu=0, this is identical to model.
          prediction_model : The model wrapped with utility functions to perform object detection (applies regression values and performs NMS).
      """
  
      modifier = freeze_model if freeze_backbone else None
  
      # load anchor parameters, or pass None (so that defaults will be used)
      anchor_params = None
      num_anchors = None
      pyramid_levels = None
      if config and "anchor_parameters" in config:
          anchor_params = parse_anchor_parameters(config)
          num_anchors = anchor_params.num_anchors()
      if config and "pyramid_levels" in config:
          pyramid_levels = parse_pyramid_levels(config)
  
      # Keras recommends initialising a multi-gpu model on the CPU to ease weight sharing, and to prevent OOM errors.
      # optionally wrap in a parallel model
      if multi_gpu > 1:
          from keras.utils import multi_gpu_model
  
          with tf.device("/cpu:0"):
              model = model_with_weights(
                  backbone_retinanet(
                      num_classes,
                      num_anchors=num_anchors,
                      modifier=modifier,
                      pyramid_levels=pyramid_levels,
                  ),
                  weights=weights,
                  skip_mismatch=True,
              )
          training_model = multi_gpu_model(model, gpus=multi_gpu)
      else:
          model = model_with_weights(
              backbone_retinanet(
                  num_classes,
                  num_anchors=num_anchors,
                  modifier=modifier,
                  pyramid_levels=pyramid_levels,
              ),
              weights=weights,
              skip_mismatch=True,
          )
          training_model = model
  
      # make prediction model
      prediction_model = retinanet_bbox(
          model=model,
          anchor_params=anchor_params,
          pyramid_levels=pyramid_levels,
      )
  
      # compile model
      training_model.compile(
          loss={
              "regression": losses.smooth_l1(),
              "classification": losses.focal(),
          },
          optimizer=keras.optimizers.Adam(
              lr=lr, clipnorm=optimizer_clipnorm
          ),
      )
  
      return model, training_model, prediction_model
  
imports: import argparse
  import os
  import sys
  import warnings
  from tensorflow import keras
  import tensorflow
  from ..None import layers
  from ..None import losses
  from ..None import models
  from ..callbacks import RedirectModel
  from ..callbacks.eval import Evaluate
  from ..models.retinanet import retinanet_bbox
  from ..preprocessing.csv_generator import CSVGenerator
  from ..preprocessing.kitti import KittiGenerator
  from ..preprocessing.open_images import OpenImagesGenerator
  from ..preprocessing.pascal_voc import PascalVocGenerator
  from ..utils.anchors import make_shapes_callback
  from ..utils.config import read_config_file, parse_anchor_parameters, parse_pyramid_levels
  from ..utils.gpu import setup_gpu
  from ..utils.image import random_visual_effect_generator
  from ..utils.model import freeze
  from ..utils.tf_version import check_tf_version
  from ..utils.transform import random_transform_generator
label_desc: Use image node_id 3 for calling a global function with example usage: create_models(backbone_retinanet, num_classes, weights, multi_gpu, freeze_backbone, lr, optimizer_clipnorm, config) and returns: model,  training_model,  prediction_model