code: def eval_function(
      exe, compiled_test_program, test_feed_names, test_fetch_list
  ):
      metric = global_config["metric"]
      for batch_id, data in enumerate(val_loader):
          data_all = convert_numpy_data(data, metric)
          data_input = {}
          for k, v in data.items():
              if isinstance(global_config["input_list"], list):
                  if k in test_feed_names:
                      data_input[k] = np.array(v)
              elif isinstance(global_config["input_list"], dict):
                  if k in global_config["input_list"].keys():
                      data_input[
                          global_config["input_list"][k]
                      ] = np.array(v)
          outs = exe.run(
              compiled_test_program,
              feed=data_input,
              fetch_list=test_fetch_list,
              return_numpy=False,
          )
          res = {}
          if (
              "include_nms" in global_config
              and not global_config["include_nms"]
          ):
              if (
                  "arch" in global_config
                  and global_config["arch"] == "PPYOLOE"
              ):
                  postprocess = PPYOLOEPostProcess(
                      score_threshold=0.01, nms_threshold=0.6
                  )
              else:
                  assert "Not support arch={} now.".format(
                      global_config["arch"]
                  )
              res = postprocess(
                  np.array(outs[0]), data_all["scale_factor"]
              )
          else:
              for out in outs:
                  v = np.array(out)
                  if len(v.shape) > 1:
                      res["bbox"] = v
                  else:
                      res["bbox_num"] = v
  
          metric.update(data_all, res)
          if batch_id % 100 == 0:
              print("Eval iter:", batch_id)
      metric.accumulate()
      metric.log()
      map_res = metric.get_results()
      metric.reset()
      map_key = (
          "keypoint"
          if "arch" in global_config
          and global_config["arch"] == "keypoint"
          else "bbox"
      )
      return map_res[map_key][0]
  
file_path: PaddleDetection/deploy/auto_compression/run.py
imports: import os
  import sys
  import numpy
  import argparse
  import paddle
  from ppdet.core.workspace import load_config, merge_config
  from ppdet.core.workspace import create
  from ppdet.metrics import COCOMetric, VOCMetric, KeyPointTopDownCOCOEval
  from paddleslim.auto_compression.config_helpers import load_config
  from paddleslim.auto_compression import AutoCompression
  from post_process import PPYOLOEPostProcess
  from paddleslim.common.dataloader import get_feed_vars
label_desc: Use image node_id 4 for calling a global function with example usage: eval_function(exe, compiled_test_program, test_feed_names, test_fetch_list) and returns: map_res