code: def main(args):
      env_info = get_sys_env()
  
      if (
          args.device == "gpu"
          and env_info["Paddle compiled with cuda"]
          and env_info["GPUs used"]
      ):
          place = "gpu"
      elif args.device == "xpu" and paddle.is_compiled_with_xpu():
          place = "xpu"
      elif (
          args.device == "npu"
          and paddle.is_compiled_with_custom_device("npu")
      ):
          place = "npu"
      elif args.device == "mlu" and paddle.is_compiled_with_mlu():
          place = "mlu"
      else:
          place = "cpu"
  
      paddle.set_device(place)
      if not args.cfg:
          raise RuntimeError("No configuration file specified.")
  
      cfg = Config(args.cfg, opts=args.opts)
      cfg.check_sync_info()
  
      # Only support for the DeepLabv3+ model
      if args.data_format == "NHWC":
          if cfg.dic["model"]["type"] != "DeepLabV3P":
              raise ValueError(
                  'The "NHWC" data format only support the DeepLabV3P model!'
              )
          cfg.dic["model"]["data_format"] = args.data_format
          cfg.dic["model"]["backbone"]["data_format"] = args.data_format
          loss_len = len(cfg.dic["loss"]["types"])
          for i in range(loss_len):
              cfg.dic["loss"]["types"][i][
                  "data_format"
              ] = args.data_format
  
      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")
  
      test_config = get_test_config(cfg, args)
  
      evaluate(
          model,
          cfg.coase_model,
          args.coase_model,
          val_dataset,
          num_workers=args.num_workers,
          **test_config,
      )
  
file_path: PaddleSeg/contrib/RSSegBenchmark/c2fnet/val.py
imports: import argparse
  import os
  import paddle
  import models
  from paddleseg.cvlibs import manager
  from paddleseg.utils import get_sys_env, logger, utils
  from cvlibs import Config
  from core import evaluate
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types