code: def main(args):
      device = torch.device(
          args.device if torch.cuda.is_available() else "cpu"
      )
      assert os.path.exists(
          args.weights
      ), f"weights {args.weights} not found."
  
      val_dataset = DUTSDataset(
          args.data_path,
          train=False,
          transforms=SODPresetEval([320, 320]),
      )
  
      num_workers = 4
      val_data_loader = data.DataLoader(
          val_dataset,
          batch_size=1,  # must be 1
          num_workers=num_workers,
          pin_memory=True,
          shuffle=False,
          collate_fn=val_dataset.collate_fn,
      )
  
      model = u2net_full()
      pretrain_weights = torch.load(args.weights, map_location="cpu")
      if "model" in pretrain_weights:
          model.load_state_dict(pretrain_weights["model"])
      else:
          model.load_state_dict(pretrain_weights)
      model.to(device)
  
      mae_metric, f1_metric = evaluate(
          model, val_data_loader, device=device
      )
      print(mae_metric, f1_metric)
  
file_path: deep-learning-for-image-processing/pytorch_segmentation/u2net/validation.py
imports: import os
  from typing import Union, List
  import torch
  from torch.utils import data
  from src import u2net_full
  from train_utils import evaluate
  from my_dataset import DUTSDataset
  import transforms
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) without return types