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]
              ),
          ]
      )
  
      image_list = sorted(
          glob(
              os.path.join(
                  args.data_path,
                  args.category,
                  "train",
                  "good",
                  "*.png",
              )
          )
      )
      train_image_list, val_image_list = train_test_split(
          image_list, test_size=0.2, random_state=0
      )
      train_dataset = MVTecDatasetSTFPM(
          train_image_list, transform=transform
      )
      train_loader = DataLoader(
          train_dataset,
          batch_size=args.batch_size,
          shuffle=True,
          drop_last=False,
          num_workers=args.num_workers,
      )
      val_dataset = MVTecDatasetSTFPM(
          val_image_list, transform=transform
      )
      val_loader = DataLoader(
          val_dataset,
          batch_size=args.batch_size,
          shuffle=False,
          drop_last=False,
          num_workers=args.num_workers,
      )
      if args.do_eval:
          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,
          )
  
      if args.do_eval:
          train(
              teacher,
              student,
              train_loader,
              val_loader,
              args,
              test_pos_loader,
              test_neg_loader,
          )
      else:
          train(teacher, student, train_loader, val_loader, args)
  
imports: import os
  import sys
  import time
  import random
  import datetime
  import argparse
  from glob import glob
  import numpy
  from sklearn.model_selection import train_test_split
  import paddle
  import paddle.nn.functional
  import paddle.optimizer
  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
  from qinspector.cvlib.uad_configs import ConfigParser
  from val import val, cal_error
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types