code: def predict(args, model, x):
      print(
          datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
          + "\t"
          + "Starting eval model..."
      )
      # extract test set features
      # model prediction
      out = model(x)
      out = model.project(out)
      score_map, image_score = model.generate_scores_map(
          out, x.shape[-2:]
      )
      # score_map = np.concatenate(score_map, 0)
  
      # Normalization
      if args.norm:
          max_score = score_map.max()
          min_score = score_map.min()
          score_map = (score_map - min_score) / (max_score - min_score)
      save_name = os.path.join(
          args.save_path + f"/{args.method}_{args.backbone}_{args.k}",
          args.category,
      )
      dir_name = os.path.dirname(save_name)
      if dir_name and not os.path.exists(dir_name):
          os.makedirs(dir_name)
      plot_fig(
          x.numpy(),
          score_map,
          None,
          args.threshold,
          save_name,
          args.category,
          args.save_pic,
          "predict",
      )
  
      print(
          datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
          + "\t"
          + "Predict :  Picture {}".format(args.img_path)
          + " done!"
      )
      if args.save_pic:
          print(
              "Result saved at {}/{}_predict.png".format(
                  save_name, args.category
              )
          )
  
file_path: PaddleSeg/contrib/QualityInspector/tools/uad/patchcore/predict.py
imports: import os
  import sys
  import random
  import argparse
  import datetime
  import numpy
  from PIL import Image
  import paddle
  import qinspector.uad.datasets.mvtec
  from qinspector.uad.models.patchcore import get_model
  from qinspector.uad.utils.utils import plot_fig, str2bool
  from qinspector.cvlib.uad_configs import ConfigParser
label_desc: Use image node_id 3 for calling a global function with example usage: predict(args, model, x) without return types