code: def do_predict(pred_func, input_file):
      img = cv2.imread(input_file, cv2.IMREAD_COLOR)
      results = predict_image(img, pred_func)
      if cfg.MODE_MASK:
          final = draw_final_outputs_blackwhite(img, results)
      else:
          final = draw_final_outputs(img, results)
      viz = np.concatenate((img, final), axis=1)
      cv2.imwrite("output.png", viz)
      logger.info(
          "Inference output for {} written to output.png".format(
              input_file
          )
      )
      tpviz.interactive_imshow(viz)
  
imports: import argparse
  import itertools
  import numpy
  import os
  import shutil
  import tensorflow
  import cv2
  import tqdm
  import tensorpack.utils.viz
  from tensorpack.predict import MultiTowerOfflinePredictor, OfflinePredictor, PredictConfig
  from tensorpack.tfutils import SmartInit, get_tf_version_tuple
  from tensorpack.tfutils.export import ModelExporter
  from tensorpack.utils import fs, logger
  from dataset import DatasetRegistry, register_coco, register_balloon
  from config import config
  from config import finalize_configs
  from data import get_eval_dataflow, get_train_dataflow
  from eval import DetectionResult, multithread_predict_dataflow, predict_image
  from modeling.generalized_rcnn import ResNetC4Model, ResNetFPNModel
  from viz import draw_annotation, draw_final_outputs, draw_predictions, draw_proposal_recall, draw_final_outputs_blackwhite
label_desc: Use image node_id 3 for calling a global function with example usage: do_predict(pred_func, input_file) without return types