code: def main(args):
      assert (
          args.config is not None
      ), "No configuration file specified, please set --config"
      cfg = Config(args.config)
      builder = SegBuilder(cfg)
  
      utils.show_env_info()
      utils.show_cfg_info(cfg)
      os.environ["PADDLESEG_EXPORT_STAGE"] = "True"
  
      # save model
      model = builder.model
      if args.model_path is not None:
          state_dict = paddle.load(args.model_path)
          model.set_dict(state_dict)
          logger.info("Loaded trained params successfully.")
      if args.output_op != "none":
          model = WrappedModel(model, args.output_op)
  
      shape = (
          [None, 3, None, None]
          if args.input_shape is None
          else args.input_shape
      )
      input_spec = [
          paddle.static.InputSpec(shape=shape, dtype="float32")
      ]
      model.eval()
      model = paddle.jit.to_static(model, input_spec=input_spec)
      paddle.jit.save(model, os.path.join(args.save_dir, "model"))
  
      # save deploy.yaml
      val_dataset_cfg = cfg.val_dataset_cfg
      assert (
          val_dataset_cfg != {}
      ), "No val_dataset specified in the configuration file."
      transforms = val_dataset_cfg.get("transforms", None)
      output_dtype = (
          "int32" if args.output_op == "argmax" else "float32"
      )
  
      # TODO add test config
      deploy_info = {
          "Deploy": {
              "model": "model.pdmodel",
              "params": "model.pdiparams",
              "transforms": transforms,
              "input_shape": shape,
              "output_op": args.output_op,
              "output_dtype": output_dtype,
          }
      }
      msg = "\n---------------Deploy Information---------------\n"
      msg += str(yaml.dump(deploy_info))
      logger.info(msg)
  
      yml_file = os.path.join(args.save_dir, "deploy.yaml")
      with open(yml_file, "w") as file:
          yaml.dump(deploy_info, file)
  
      logger.info(f"The inference model is saved in {args.save_dir}")
  
file_path: PaddleSeg/contrib/QualityInspector/tools/seg/export.py
imports: import argparse
  import os
  import paddle
  import yaml
  from paddleseg.cvlibs import Config, SegBuilder
  from paddleseg.utils import logger, utils
  from paddleseg.deploy.export import WrappedModel
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types