code: def setup_model_for_training(model, weights_file, output_dir):
      """Loaded saved weights and create the network in the C2 workspace."""
      logger = logging.getLogger(__name__)
      add_model_training_inputs(model)
  
      if weights_file:
          # Override random weight initialization with weights from a saved model
          nu.initialize_gpu_from_weights_file(
              model, weights_file, gpu_id=0
          )
      # Even if we're randomly initializing we still need to synchronize
      # parameters across GPUs
      nu.broadcast_parameters(model)
      workspace.CreateNet(model.net)
  
      logger.info(
          "Outputs saved to: {:s}".format(os.path.abspath(output_dir))
      )
      dump_proto_files(model, output_dir)
  
      # Start loading mini-batches and enqueuing blobs
      model.roi_data_loader.register_sigint_handler()
      model.roi_data_loader.start(prefill=True)
      return output_dir
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import cv2
  import logging
  import numpy
  import os
  import re
  from caffe2.python import memonger
  from caffe2.python import workspace
  from detectron.core.config import cfg
  from detectron.core.config import get_output_dir
  from detectron.datasets.roidb import combined_roidb_for_training
  from detectron.modeling import model_builder
  from detectron.utils import lr_policy
  from detectron.utils.training_stats import TrainingStats
  import detectron.utils.env
  import detectron.utils.net
label_desc: Use image node_id 4 for calling a global function with example usage: setup_model_for_training(model, weights_file, output_dir) and returns: output_dir