code: def pred_with_args(args):
      if not args.cfg:
          raise RuntimeError(
              "No configuration file has been specified."
          )
      cfg = Config(args.cfg)
      builder = make_default_builder(cfg)
  
      utils.show_env_info()
      utils.show_cfg_info(cfg)
  
      model = builder.model
      val_dataset = builder.val_dataset
      transforms = constr_test_transforms(val_dataset.transforms)
      image_list, image_dir = get_image_list(args.image_path)
      logger.info(
          "Number of images for prediction = {}.".format(
              len(image_list)
          )
      )
  
      predict(
          model,
          model_path=args.model_path,
          transforms=transforms,
          postprocessor=builder.postprocessor,
          image_list=image_list,
          label_divisor=val_dataset.label_divisor,
          ignore_index=val_dataset.ignore_index,
          image_dir=image_dir,
          colormap=val_dataset.get_colormap(),
          save_dir=args.save_dir,
      )
  
imports: import argparse
  from paddleseg.utils import logger, get_image_list, utils
  from paddlepanseg.core import predict
  from paddlepanseg.cvlibs import Config, make_default_builder
  from paddlepanseg.transforms import constr_test_transforms
label_desc: Use image node_id 2 for calling a global function with example usage: pred_with_args(args) without return types