code: def main():
      parser = argparse.ArgumentParser()
      parser.add_argument(
          "--checkpoint",
          dest="checkpoint",
          help="Required. The path where weights locates.",
      )
      parser.add_argument(
          "--names",
          dest="names",
          help="Required. The path where classes name locates.",
      )
      parser.add_argument(
          "--class_num",
          dest="class_num",
          type=int,
          default=20,
          help="Required. class num.",
      )
      parser.add_argument(
          "--image", dest="image", help="Required. image path."
      )
      parser.add_argument(
          "--output",
          dest="output",
          default="./output.jpg",
          help="Image output path.",
      )
  
      options = parser.parse_args()
  
      yolo = YoloV3(classes=options.class_num)
  
      yolo.load_weights(options.checkpoint).expect_partial()
      print("weights loaded")
  
      class_names = [c.strip() for c in open(options.names).readlines()]
      print("names loaded")
  
      img_raw = tf.image.decode_image(
          open(options.image, "rb").read(), channels=3
      )
  
      img = tf.expand_dims(img_raw, 0)
      img = transform_images(img, DEFAULT_IMAGE_SIZE)
  
      t1 = time.time()
      boxes, scores, classes, nums = yolo(img)
      boxes = tf.clip_by_value(
          boxes, clip_value_min=0.0, clip_value_max=1.0
      )
      t2 = time.time()
      print("time: {}".format(t2 - t1))
  
      print("detections:")
      for i in range(nums[0]):
          print(
              "\t{}, {}, {}".format(
                  class_names[int(classes[0][i])],
                  np.array(scores[0][i]),
                  np.array(boxes[0][i]),
              )
          )
  
      img = cv2.cvtColor(img_raw.numpy(), cv2.COLOR_RGB2BGR)
      img = draw_outputs(
          img, (boxes, scores, classes, nums), class_names
      )
      cv2.imwrite(options.output, img)
      print("output: {}".format(options.output))
  
file_path: BigDL/python/orca/example/learn/tf2/yolov3/predict.py
imports: import time
  import cv2
  import numpy
  import tensorflow
  from yoloV3 import YoloV3, transform_images
  import argparse
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types