code: def train_faster_rcnn(cfg):
      # Train only if no model exists yet
      model_path = cfg["MODEL_PATH"]
      if os.path.exists(model_path) and cfg["CNTK"].MAKE_MODE:
          print("Loading existing model from %s" % model_path)
          eval_model = load_model(model_path)
      else:
          if cfg["CNTK"].TRAIN_E2E:
              eval_model = train_faster_rcnn_e2e(cfg)
          else:
              eval_model = train_faster_rcnn_alternating(cfg)
  
          eval_model.save(model_path)
          if cfg["CNTK"].DEBUG_OUTPUT:
              plot(
                  eval_model,
                  os.path.join(
                      cfg.OUTPUT_PATH,
                      "graph_frcn_eval_{}_{}.{}".format(
                          cfg["MODEL"].BASE_MODEL,
                          "e2e" if cfg["CNTK"].TRAIN_E2E else "4stage",
                          cfg["CNTK"].GRAPH_TYPE,
                      ),
                  ),
              )
  
          print("Stored eval model at %s" % model_path)
      return eval_model
  
imports: from __future__ import print_function
  import numpy
  import os, sys
  import argparse
  import easydict
  import cntk
  from cntk import Trainer, load_model, Axis, input_variable, parameter, times, combine, softmax, roipooling, plus, element_times, CloneMethod, alias, Communicator, reduce_sum
  from cntk.core import Value
  from cntk.io import MinibatchData
  from cntk.initializer import normal
  from cntk.layers import placeholder, Constant, Sequential
  from cntk.learners import momentum_sgd, learning_parameter_schedule_per_sample, momentum_schedule
  from cntk.logging import log_number_of_parameters, ProgressPrinter
  from cntk.logging.graph import find_by_name, plot
  from cntk.losses import cross_entropy_with_softmax
  from cntk.metrics import classification_error
  from _cntk_py import force_deterministic_algorithms
  from utils.rpn.rpn_helpers import create_rpn, create_proposal_target_layer, create_proposal_layer
  from utils.annotations.annotations_helper import parse_class_map_file
  from utils.od_mb_source import ObjectDetectionMinibatchSource
  from utils.proposal_helpers import ProposalProvider
  from FastRCNN.FastRCNN_train import clone_model, clone_conv_layers, create_fast_rcnn_predictor, create_detection_losses
label_desc: Use image node_id 7 for calling a global function with example usage: train_faster_rcnn(cfg) and returns: eval_model