code: def eval(predictor, val_loader, metric, rerun_flag=False):
      """
      eval main func
      """
      cpu_mems, gpu_mems = 0, 0
      predict_time = 0.0
      time_min = float("inf")
      time_max = float("-inf")
      sample_nums = len(val_loader)
      input_names = predictor.get_input_names()
      output_names = predictor.get_output_names()
      boxes_tensor = predictor.get_output_handle(output_names[0])
      if FLAGS.include_nms:
          boxes_num = predictor.get_output_handle(output_names[1])
      for batch_id, data in enumerate(val_loader):
          data_all = {k: np.array(v) for k, v in data.items()}
          for i, _ in enumerate(input_names):
              input_tensor = predictor.get_input_handle(input_names[i])
              input_tensor.copy_from_cpu(data_all[input_names[i]])
          start_time = time.time()
          predictor.run()
          np_boxes = boxes_tensor.copy_to_cpu()
          if FLAGS.include_nms:
              np_boxes_num = boxes_num.copy_to_cpu()
          if rerun_flag:
              return
          end_time = time.time()
          timed = end_time - start_time
          time_min = min(time_min, timed)
          time_max = max(time_max, timed)
          predict_time += timed
          if not FLAGS.include_nms:
              postprocess = PPYOLOEPostProcess(
                  score_threshold=0.3, nms_threshold=0.6
              )
              res = postprocess(np_boxes, data_all["scale_factor"])
          else:
              res = {"bbox": np_boxes, "bbox_num": np_boxes_num}
          metric.update(data_all, res)
          if batch_id % 100 == 0:
              print("Eval iter:", batch_id)
              sys.stdout.flush()
      metric.accumulate()
      metric.log()
      map_res = metric.get_results()
      metric.reset()
      time_avg = predict_time / sample_nums
      print(
          "[Benchmark]Inference time(ms): min={}, max={}, avg={}".format(
              round(time_min * 1000, 2),
              round(time_max * 1000, 1),
              round(time_avg * 1000, 1),
          )
      )
      print("[Benchmark] COCO mAP: {}".format(map_res["bbox"][0]))
      sys.stdout.flush()
  
imports: import os
  import argparse
  import time
  import sys
  import cv2
  import numpy
  import paddle
  from paddle.inference import Config
  from paddle.inference import create_predictor
  from ppdet.core.workspace import load_config, create
  from ppdet.metrics import COCOMetric
  from post_process import PPYOLOEPostProcess
label_desc: Use image node_id 8 for calling a global function with example usage: eval(predictor, val_loader, metric, rerun_flag) without return types