code: def create_model(
      base_model_file,
      feature_node_name,
      last_hidden_node_name,
      num_classes,
      input_features,
      freeze=False,
  ):
      # Load the pretrained classification net and find nodes
      base_model = load_model(base_model_file)
      feature_node = find_by_name(base_model, feature_node_name)
      last_node = find_by_name(base_model, last_hidden_node_name)
  
      # Clone the desired layers with fixed weights
      cloned_layers = combine([last_node.owner]).clone(
          CloneMethod.freeze if freeze else CloneMethod.clone,
          {feature_node: placeholder(name="features")},
      )
  
      # Add new dense layer for class prediction
      feat_norm = input_features - Constant(114)
      cloned_out = cloned_layers(feat_norm)
      z = Dense(
          num_classes, activation=None, name=new_output_node_name
      )(cloned_out)
  
      return z
  
imports: from __future__ import print_function
  import numpy
  import cntk
  import os
  from PIL import Image
  from cntk.device import try_set_default_device, gpu
  from cntk import load_model, placeholder, Constant
  from cntk import Trainer
  from cntk.logging.graph import find_by_name, get_node_outputs
  from cntk.io import MinibatchSource, ImageDeserializer, StreamDefs, StreamDef
  import cntk.io.transforms
  from cntk.layers import Dense
  from cntk.learners import momentum_sgd, learning_parameter_schedule, momentum_schedule
  from cntk.ops import combine, softmax
  from cntk.ops.functions import CloneMethod
  from cntk.losses import cross_entropy_with_softmax
  from cntk.metrics import classification_error
  from cntk.logging import log_number_of_parameters, ProgressPrinter
label_desc: Use image node_id 2 for calling a global function with example usage: create_model(base_model_file, feature_node_name, last_hidden_node_name, num_classes, input_features, freeze) and returns: z