code: def main(args):
      env_info = get_sys_env()
      place = (
          "gpu"
          if env_info["Paddle compiled with cuda"]
          and env_info["GPUs used"]
          else "cpu"
      )
  
      paddle.set_device(place)
      if not args.cfg:
          raise RuntimeError("No configuration file specified.")
  
      cfg = Config(args.cfg)
      losses = cfg.loss
  
      val_dataset = cfg.val_dataset
      if val_dataset is None:
          raise RuntimeError(
              "The verification dataset is not specified in the configuration file."
          )
      elif len(val_dataset) == 0:
          raise ValueError(
              "The length of val_dataset is 0. Please check if your dataset is valid"
          )
  
      msg = "\n---------------Config Information---------------\n"
      msg += str(cfg)
      msg += "------------------------------------------------"
      logger.info(msg)
  
      model = cfg.model
      if args.model_path:
          utils.load_entire_model(model, args.model_path)
          logger.info("Loaded trained params of model successfully")
  
      if args.use_vdl:
          from visualdl import LogWriter
  
          log_writer = LogWriter(args.save_dir)
  
      evaluate(
          model,
          val_dataset,
          losses,
          num_workers=args.num_workers,
          print_detail=args.print_detail,
          auc_roc=args.auc_roc,
          writer=log_writer,
          save_dir=args.save_dir,
          sw_num=args.sw_num,
          is_save_data=args.is_save_data,
          has_dataset_json=args.has_dataset_json,
      )
  
file_path: PaddleSeg/contrib/MedicalSeg/val.py
imports: import argparse
  import os
  import paddle
  from medicalseg.cvlibs import Config
  from medicalseg.core import evaluate
  from medicalseg.utils import get_sys_env, logger, utils
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types