code: def main(args):
      logger = logging.getLogger(__name__)
      dummy_coco_dataset = dummy_datasets.get_coco_dataset()
      cfg_orig = load_cfg(yaml.dump(cfg))
      im = cv2.imread(args.im_file)
  
      if args.rpn_pkl is not None:
          proposal_boxes, _proposal_scores = get_rpn_box_proposals(
              im, args
          )
          workspace.ResetWorkspace()
      else:
          proposal_boxes = None
  
      cls_boxes, cls_segms, cls_keyps, cls_bodys = (
          None,
          None,
          None,
          None,
      )
      for i in range(0, len(args.models_to_run), 2):
          pkl = args.models_to_run[i]
          yml = args.models_to_run[i + 1]
          cfg.immutable(False)
          merge_cfg_from_cfg(cfg_orig)
          merge_cfg_from_file(yml)
          if len(pkl) > 0:
              weights_file = pkl
          else:
              weights_file = cfg.TEST.WEIGHTS
          cfg.NUM_GPUS = 1
          assert_and_infer_cfg(cache_urls=False)
          model = model_engine.initialize_model_from_cfg(weights_file)
          with c2_utils.NamedCudaScope(0):
              (
                  cls_boxes_,
                  cls_segms_,
                  cls_keyps_,
                  cls_bodys_,
              ) = model_engine.im_detect_all(model, im, proposal_boxes)
          cls_boxes = (
              cls_boxes_ if cls_boxes_ is not None else cls_boxes
          )
          cls_segms = (
              cls_segms_ if cls_segms_ is not None else cls_segms
          )
          cls_keyps = (
              cls_keyps_ if cls_keyps_ is not None else cls_keyps
          )
          cls_bodys = (
              cls_bodys_ if cls_bodys_ is not None else cls_bodys
          )
  
          workspace.ResetWorkspace()
  
      out_name = os.path.join(
          args.output_dir,
          "{}".format(os.path.basename(args.im_file) + ".pdf"),
      )
      logger.info("Processing {} -> {}".format(args.im_file, out_name))
  
      import numpy as np
      import pickle
  
      f = open("test_vis.pkl", "w")
      pickle.dump(
          {
              "im": im,
              "cls_boxes": np.array(cls_boxes),
              "cls_bodys": np.array(cls_bodys),
          },
          f,
      )
      f.close()
  
      vis_utils.vis_one_image(
          im[:, :, ::-1],
          args.im_file,
          args.output_dir,
          cls_boxes,
          cls_segms,
          cls_keyps,
          cls_bodys,
          dataset=dummy_coco_dataset,
          box_alpha=0.3,
          show_class=True,
          thresh=0.7,
          kp_thresh=2,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import argparse
  import cv2
  import logging
  import os
  import sys
  import yaml
  from caffe2.python import workspace
  from detectron.core.config import assert_and_infer_cfg
  from detectron.core.config import cfg
  from detectron.core.config import load_cfg
  from detectron.core.config import merge_cfg_from_cfg
  from detectron.core.config import merge_cfg_from_file
  from detectron.utils.io import cache_url
  from detectron.utils.logging import setup_logging
  import detectron.core.rpn_generator
  import detectron.core.test_engine
  import detectron.datasets.dummy_datasets
  import detectron.utils.c2
  import detectron.utils.vis
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types