code: def main(args):
      assert (
          args.cfg is not None
      ), "No configuration file specified, please set --config"
      cfg = Config(args.cfg, opts=args.opts)
      builder = MatBuilder(cfg)
  
      paddleseg.utils.show_env_info()
      paddleseg.utils.show_cfg_info(cfg)
      paddleseg.utils.set_device(args.device)
  
      model = builder.model
      val_dataset = builder.val_dataset
  
      if isinstance(model, paddle.nn.Layer):
          if args.model_path:
              utils.load_entire_model(model, args.model_path)
              logger.info("Loaded trained params of model successfully")
          evaluate(
              model,
              val_dataset,
              num_workers=args.num_workers,
              save_dir=args.save_dir,
              save_results=args.save_results,
              metrics=args.metrics,
          )
      else:
          evaluate_ml(
              model,
              val_dataset,
              save_dir=args.save_dir,
              save_results=args.save_results,
          )
  
file_path: PaddleSeg/Matting/tools/val.py
imports: import argparse
  import os
  import sys
  import paddle
  import paddleseg
  from paddleseg.cvlibs import manager
  from paddleseg.utils import get_sys_env, logger, utils
  import ppmatting
  from ppmatting.core import evaluate, evaluate_ml
  from ppmatting.utils import Config, MatBuilder
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types