code: def build_predefined(
      name,
      num_classes,
      input_shape=(224, 224, 3),
      freeze_layers=None,
      activation="softmax",
      pt_fc=[],
      pt_ps=[],
  ):
      """
      ```
      Builds a pre-defined architecture supported in Keras.
  
      Args:
          name (str): one of ktrain.vision.model.PREDEFINED_MODELS
          num_classes (int): # of classes
          input_shape (tuple): the input shape including channels
          freeze_layers (int): number of early layers to freeze.
                               Only takes effect if name in PRETRAINED_MODELS.
                               If None and name in PRETRAINED_MODELS,
                               all layers except the "custom head"
                               fully-connected (Dense) layers are frozen.
          activation (str):    name of the Keras activation to use in final layer
          pt_fc (list of ints): number of hidden units in extra Dense layers
                                  before final Dense layer of pretrained model
          pt_ps (list of floats): dropout probabilities to use before
                                        each extra Dense layer in pretrained model
      ```
      """
  
      # default parameters
      include_top = False
      input_tensor = None
      dropout = 0.5  # final dropout
  
      # setup pretrained
      weights = "imagenet" if name in PRETRAINED_MODELS else None
  
      # setup the pretrained network
      if name in [RESNET50, PRETRAINED_RESNET50]:
          with warnings.catch_warnings():
              warnings.simplefilter("ignore")
              net = keras.applications.ResNet50(
                  include_top=include_top,
                  weights=weights,
                  input_tensor=input_tensor,
                  input_shape=input_shape,
              )
      elif name in [MOBILENET, PRETRAINED_MOBILENET]:
          net = keras.applications.MobileNet(
              include_top=include_top,
              weights=weights,
              input_tensor=input_tensor,
              input_shape=input_shape,
          )
      elif name in [MOBILENETV3, PRETRAINED_MOBILENETV3]:
          net = keras.applications.MobileNetV3Small(
              include_top=include_top,
              weights=weights,
              input_tensor=input_tensor,
              input_shape=input_shape,
          )
      elif name in [INCEPTION, PRETRAINED_INCEPTION]:
          net = keras.applications.InceptionV3(
              include_top=include_top,
              weights=weights,
              input_tensor=input_tensor,
              input_shape=input_shape,
          )
      elif name in [EFFICIENTNETB1, PRETRAINED_EFFICIENTNETB1]:
          net = keras.applications.EfficientNetB1(
              include_top=include_top,
              weights=weights,
              input_tensor=input_tensor,
              input_shape=input_shape,
          )
      elif name in [EFFICIENTNETB7, PRETRAINED_EFFICIENTNETB7]:
          net = keras.applications.EfficientNetB7(
              include_top=include_top,
              weights=weights,
              input_tensor=input_tensor,
              input_shape=input_shape,
          )
      else:
          raise ValueError("Unsupported model: %s" % (name))
  
      if freeze_layers is None:
          for layer in net.layers:
              layer.trainable = False
  
      x = net.output
      x = keras.layers.Flatten()(x)
  
      # xtra FCs in pretrained model
      if name in PRETRAINED_MODELS:
          if len(pt_fc) != len(pt_ps):
              raise ValueError(
                  "size off xtra_fc must match size of fc_dropouts"
              )
          for i, fc in enumerate(pt_fc):
              p = pt_ps[i]
              fc_name = "fc%s" % (i)
              if p is not None:
                  x = keras.layers.Dropout(p)(x)
              x = keras.layers.Dense(
                  fc,
                  activation="relu",
                  kernel_initializer="he_normal",
                  name=fc_name,
              )(x)
  
      # final FC
      x = keras.layers.Dropout(dropout)(x)
      output_layer = keras.layers.Dense(
          num_classes, activation=activation, name=activation
      )(x)
      model = keras.Model(inputs=net.input, outputs=output_layer)
  
      if freeze_layers is not None:
          # set certain earlier layers as non-trainable
          for layer in model.layers[:freeze_layers]:
              layer.trainable = False
          for layer in model.layers[freeze_layers:]:
              layer.trainable = True
  
      # set optimizer, loss, and metrics and return model
      return model
  
file_path: ktrain/ktrain/vision/models.py
imports: from ..None import utils
  from ..imports import *
  from .wrn import create_wide_residual_network
label_desc: Use image node_id 9 for calling a global function with example usage: build_predefined(name, num_classes, input_shape, freeze_layers, activation, pt_fc, pt_ps) and returns: model