code: def prepare(cfg, use_arg_parser=True):
      cfg.MB_SIZE = 1
      cfg.NUM_CHANNELS = 3
      cfg.OUTPUT_PATH = os.path.join(abs_path, "Output")
      cfg["DATA"].MAP_FILE_PATH = os.path.join(
          abs_path, cfg["DATA"].MAP_FILE_PATH
      )
      running_locally = os.path.exists(cfg["DATA"].MAP_FILE_PATH)
      if running_locally:
          os.chdir(cfg["DATA"].MAP_FILE_PATH)
          if not os.path.exists(os.path.join(abs_path, "Output")):
              os.makedirs(os.path.join(abs_path, "Output"))
          if not os.path.exists(
              os.path.join(abs_path, "Output", cfg["DATA"].DATASET)
          ):
              os.makedirs(
                  os.path.join(abs_path, "Output", cfg["DATA"].DATASET)
              )
      else:
          # disable debug and plot outputs when running on GPU cluster
          cfg["CNTK"].DEBUG_OUTPUT = False
          cfg.VISUALIZE_RESULTS = False
  
      if use_arg_parser:
          parse_arguments(cfg)
  
      data_path = cfg["DATA"].MAP_FILE_PATH
      if not os.path.isdir(data_path):
          raise RuntimeError("Directory %s does not exist" % data_path)
  
      cfg["DATA"].CLASS_MAP_FILE = os.path.join(
          data_path, cfg["DATA"].CLASS_MAP_FILE
      )
      cfg["DATA"].TRAIN_MAP_FILE = os.path.join(
          data_path, cfg["DATA"].TRAIN_MAP_FILE
      )
      cfg["DATA"].TEST_MAP_FILE = os.path.join(
          data_path, cfg["DATA"].TEST_MAP_FILE
      )
      cfg["DATA"].TRAIN_ROI_FILE = os.path.join(
          data_path, cfg["DATA"].TRAIN_ROI_FILE
      )
      cfg["DATA"].TEST_ROI_FILE = os.path.join(
          data_path, cfg["DATA"].TEST_ROI_FILE
      )
  
      cfg["MODEL_PATH"] = os.path.join(
          cfg.OUTPUT_PATH,
          "faster_rcnn_eval_{}_{}.model".format(
              cfg["MODEL"].BASE_MODEL,
              "e2e" if cfg["CNTK"].TRAIN_E2E else "4stage",
          ),
      )
      cfg["BASE_MODEL_PATH"] = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "..",
          "..",
          "..",
          "..",
          "PretrainedModels",
          cfg["MODEL"].BASE_MODEL_FILE,
      )
  
      cfg["DATA"].CLASSES = parse_class_map_file(
          cfg["DATA"].CLASS_MAP_FILE
      )
      cfg["DATA"].NUM_CLASSES = len(cfg["DATA"].CLASSES)
  
      if cfg["CNTK"].FAST_MODE:
          cfg["CNTK"].E2E_MAX_EPOCHS = 1
          cfg["CNTK"].RPN_EPOCHS = 1
          cfg["CNTK"].FRCN_EPOCHS = 1
  
      if cfg["CNTK"].FORCE_DETERMINISTIC:
          force_deterministic_algorithms()
      np.random.seed(seed=cfg.RND_SEED)
  
      if False and cfg["CNTK"].DEBUG_OUTPUT:
          # report args
          print("Using the following parameters:")
          print(
              "Flip image       : {}".format(cfg["TRAIN"].USE_FLIPPED)
          )
          print("Train conv layers: {}".format(cfg.TRAIN_CONV_LAYERS))
          print("Random seed      : {}".format(cfg.RND_SEED))
          print(
              "Momentum per MB  : {}".format(
                  cfg["CNTK"].MOMENTUM_PER_MB
              )
          )
          if cfg["CNTK"].TRAIN_E2E:
              print(
                  "E2E epochs       : {}".format(
                      cfg["CNTK"].E2E_MAX_EPOCHS
                  )
              )
          else:
              print(
                  "RPN lr factor    : {}".format(
                      cfg["CNTK"].RPN_LR_FACTOR
                  )
              )
              print(
                  "RPN epochs       : {}".format(cfg["CNTK"].RPN_EPOCHS)
              )
              print(
                  "FRCN lr factor   : {}".format(
                      cfg["CNTK"].FRCN_LR_FACTOR
                  )
              )
              print(
                  "FRCN epochs      : {}".format(
                      cfg["CNTK"].FRCN_EPOCHS
                  )
              )
  
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 1 for calling a global function with example usage: prepare(cfg, use_arg_parser) without return types