code: def face_eval_run(
      model,
      image_dir,
      gt_file,
      pred_dir="output/pred",
      eval_mode="widerface",
      multi_scale=False,
  ):
      # load ground truth files
      with open(gt_file, "r") as f:
          gt_lines = f.readlines()
      imid2path = []
      pos_gt = 0
      while pos_gt < len(gt_lines):
          name_gt = gt_lines[pos_gt].strip("\n\t").split()[0]
          imid2path.append(name_gt)
          pos_gt += 1
          n_gt = int(gt_lines[pos_gt].strip("\n\t").split()[0])
          pos_gt += 1 + n_gt
      logger.info(
          "The ground truth file load {} images".format(len(imid2path))
      )
  
      dets_dist = OrderedDict()
      for iter_id, im_path in enumerate(imid2path):
          image_path = os.path.join(image_dir, im_path)
          if eval_mode == "fddb":
              image_path += ".jpg"
          assert os.path.exists(image_path)
          image = cv2.imread(image_path)
          image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
          if multi_scale:
              shrink, max_shrink = get_shrink(
                  image.shape[0], image.shape[1]
              )
              det0 = detect_face(model, image, shrink)
              det1 = flip_test(model, image, shrink)
              [det2, det3] = multi_scale_test(model, image, max_shrink)
              det4 = multi_scale_test_pyramid(model, image, max_shrink)
              det = np.row_stack((det0, det1, det2, det3, det4))
              dets = bbox_vote(det)
          else:
              dets = detect_face(model, image, 1)
          if eval_mode == "widerface":
              save_widerface_bboxes(image_path, dets, pred_dir)
          else:
              dets_dist[im_path] = dets
          if iter_id % 100 == 0:
              logger.info("Test iter {}".format(iter_id))
      if eval_mode == "fddb":
          save_fddb_bboxes(dets_dist, pred_dir)
      logger.info("Finish evaluation.")
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import cv2
  import numpy
  from collections import OrderedDict
  import paddle
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 1 for calling a global function with example usage: face_eval_run(model, image_dir, gt_file, pred_dir, eval_mode, multi_scale) without return types