code: def main():
      args = argsparser()
      config_parser = ConfigParser(args)
      args = config_parser.parser()
  
      random.seed(args.seed)
      np.random.seed(args.seed)
      paddle.seed(args.seed)
      paddle.device.set_device(args.device)
  
      # build model
      teacher = ResNet_MS3(arch=args.backbone, pretrained=True)
      student = ResNet_MS3(arch=args.backbone, pretrained=False)
  
      # build datasets
      transform = transforms.Compose(
          [
              transforms.Resize(args.resize),
              transforms.ToTensor(),
              transforms.Normalize(
                  mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
              ),
          ]
      )
  
      test_neg_image_list = sorted(
          glob(
              os.path.join(
                  args.data_path, args.category, "test", "good", "*.png"
              )
          )
      )
      test_pos_image_list = set(
          glob(
              os.path.join(
                  args.data_path, args.category, "test", "*", "*.png"
              )
          )
      ) - set(test_neg_image_list)
      test_pos_image_list = sorted(list(test_pos_image_list))
      test_neg_dataset = MVTecDatasetSTFPM(
          test_neg_image_list, transform=transform
      )
      test_pos_dataset = MVTecDatasetSTFPM(
          test_pos_image_list, transform=transform
      )
      test_neg_loader = DataLoader(
          test_neg_dataset,
          batch_size=1,
          shuffle=False,
          drop_last=False,
          num_workers=args.num_workers,
      )
      test_pos_loader = DataLoader(
          test_pos_dataset,
          batch_size=1,
          shuffle=False,
          drop_last=False,
          num_workers=args.num_workers,
      )
  
      saved_dict = paddle.load(args.model_path)
      print("load " + args.model_path)
      student.load_dict(saved_dict)
  
      val(
          args,
          student,
          teacher,
          test_pos_loader,
          test_neg_loader,
          epoch=None,
          eval_pro=args.compute_pro,
      )
  
file_path: PaddleSeg/contrib/QualityInspector/tools/uad/stfpm/val.py
imports: import os
  import sys
  import random
  import datetime
  import argparse
  from glob import glob
  import cv2
  import numpy
  import paddle
  import paddle.nn.functional
  from paddle.io import DataLoader
  from paddle.vision import transforms
  from qinspector.uad.models.stfpm import ResNet_MS3
  from qinspector.uad.datasets.mvtec import MVTecDatasetSTFPM, load_gt
  from qinspector.uad.utils.utils import eval_metric
  from qinspector.cvlib.uad_configs import ConfigParser
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types