code: def _dump_infer_config(config, path, image_shape, model):
      arch_state = False
      from ppdet.core.config.yaml_helpers import setup_orderdict
  
      setup_orderdict()
      use_dynamic_shape = True if image_shape[2] == -1 else False
      infer_cfg = OrderedDict(
          {
              "mode": "paddle",
              "draw_threshold": 0.5,
              "metric": config["metric"],
              "use_dynamic_shape": use_dynamic_shape,
          }
      )
      export_onnx = config.get("export_onnx", False)
      export_eb = config.get("export_eb", False)
  
      infer_arch = config["architecture"]
      if "RCNN" in infer_arch and export_onnx:
          logger.warning(
              "Exporting RCNN model to ONNX only support batch_size = 1"
          )
          infer_cfg["export_onnx"] = True
          infer_cfg["export_eb"] = export_eb
  
      if infer_arch in MOT_ARCH:
          if infer_arch == "DeepSORT":
              tracker_cfg = config["DeepSORTTracker"]
          elif infer_arch == "CenterTrack":
              tracker_cfg = config["CenterTracker"]
          else:
              tracker_cfg = config["JDETracker"]
          infer_cfg["tracker"] = _parse_tracker(tracker_cfg)
  
      for arch, min_subgraph_size in TRT_MIN_SUBGRAPH.items():
          if arch in infer_arch:
              infer_cfg["arch"] = arch
              infer_cfg["min_subgraph_size"] = min_subgraph_size
              arch_state = True
              break
  
      if infer_arch == "PPYOLOEWithAuxHead":
          infer_arch = "PPYOLOE"
  
      if infer_arch in ["PPYOLOE", "YOLOX", "YOLOF"]:
          infer_cfg["arch"] = infer_arch
          infer_cfg["min_subgraph_size"] = TRT_MIN_SUBGRAPH[infer_arch]
          arch_state = True
  
      if not arch_state:
          logger.error(
              "Architecture: {} is not supported for exporting model now.\n".format(
                  infer_arch
              )
              + "Please set TRT_MIN_SUBGRAPH in ppdet/engine/export_utils.py"
          )
          os._exit(0)
      if (
          "mask_head" in config[config["architecture"]]
          and config[config["architecture"]]["mask_head"]
      ):
          infer_cfg["mask"] = True
      label_arch = "detection_arch"
      if infer_arch in KEYPOINT_ARCH:
          label_arch = "keypoint_arch"
  
      if infer_arch in LANE_ARCH:
          infer_cfg["arch"] = infer_arch
          infer_cfg["min_subgraph_size"] = TRT_MIN_SUBGRAPH[infer_arch]
          infer_cfg["img_w"] = config["img_w"]
          infer_cfg["ori_img_h"] = config["ori_img_h"]
          infer_cfg["cut_height"] = config["cut_height"]
          label_arch = "lane_arch"
          head_name = "CLRHead"
          infer_cfg["conf_threshold"] = config[head_name][
              "conf_threshold"
          ]
          infer_cfg["nms_thres"] = config[head_name]["nms_thres"]
          infer_cfg["max_lanes"] = config[head_name]["max_lanes"]
          infer_cfg["num_points"] = config[head_name]["num_points"]
          arch_state = True
  
      if infer_arch in MOT_ARCH:
          if config["metric"] in ["COCO", "VOC"]:
              # MOT model run as Detector
              reader_cfg = config["TestReader"]
              dataset_cfg = config["TestDataset"]
          else:
              # 'metric' in ['MOT', 'MCMOT', 'KITTI']
              label_arch = "mot_arch"
              reader_cfg = config["TestMOTReader"]
              dataset_cfg = config["TestMOTDataset"]
      else:
          reader_cfg = config["TestReader"]
          dataset_cfg = config["TestDataset"]
  
      infer_cfg["Preprocess"], infer_cfg["label_list"] = _parse_reader(
          reader_cfg,
          dataset_cfg,
          config["metric"],
          label_arch,
          image_shape[1:],
      )
  
      if infer_arch == "PicoDet":
          if (
              hasattr(config, "export")
              and config["export"].get("post_process", False)
              and not config["export"].get("benchmark", False)
          ):
              infer_cfg["arch"] = "GFL"
          head_name = (
              "PicoHeadV2" if config["PicoHeadV2"] else "PicoHead"
          )
          infer_cfg["NMS"] = config[head_name]["nms"]
          # In order to speed up the prediction, the threshold of nms
          # is adjusted here, which can be changed in infer_cfg.yml
          config[head_name]["nms"]["score_threshold"] = 0.3
          config[head_name]["nms"]["nms_threshold"] = 0.5
          infer_cfg["fpn_stride"] = config[head_name]["fpn_stride"]
  
      yaml.dump(infer_cfg, open(path, "w"))
      logger.info(
          "Export inference config file to {}".format(
              os.path.join(path)
          )
      )
  
file_path: PaddleDetection/ppdet/engine/export_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import yaml
  from collections import OrderedDict
  import paddle
  from ppdet.data.source.category import get_categories
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 5 for calling a global function with example usage: _dump_infer_config(config, path, image_shape, model) without return types