code: def main(args):
      use_norm_score = True  # if Ture, TestMode(N1)
      use_detector_score = True  # if Ture, TestMode(D1)
      use_flip_test = True  # if Ture, TestMode(F1)
      assert args.target == "IJBC" or args.target == "IJBB"
  
      start = timeit.default_timer()
      templates, medias = read_template_media_list(
          os.path.join(
              "%s/meta" % args.image_path,
              "%s_face_tid_mid.txt" % args.target.lower(),
          )
      )
      stop = timeit.default_timer()
      print("Time: %.2f s. " % (stop - start))
  
      start = timeit.default_timer()
      p1, p2, label = read_template_pair_list(
          os.path.join(
              "%s/meta" % args.image_path,
              "%s_template_pair_label.txt" % args.target.lower(),
          )
      )
      stop = timeit.default_timer()
      print("Time: %.2f s. " % (stop - start))
  
      start = timeit.default_timer()
      img_path = "%s/loose_crop" % args.image_path
      img_list_path = "%s/meta/%s_name_5pts_score.txt" % (
          args.image_path,
          args.target.lower(),
      )
      img_list = open(img_list_path)
      files = img_list.readlines()
      dataset = AlignedDataSet(root=img_path, lines=files, align=True)
      img_feats = extract(args.model_root, dataset)
  
      faceness_scores = []
      for each_line in files:
          name_lmk_score = each_line.split()
          faceness_scores.append(name_lmk_score[-1])
      faceness_scores = np.array(faceness_scores).astype(np.float32)
      stop = timeit.default_timer()
      print("Time: %.2f s. " % (stop - start))
      print(
          "Feature Shape: ({} , {}) .".format(
              img_feats.shape[0], img_feats.shape[1]
          )
      )
      start = timeit.default_timer()
  
      if use_flip_test:
          img_input_feats = (
              img_feats[:, 0 : img_feats.shape[1] // 2]
              + img_feats[:, img_feats.shape[1] // 2 :]
          )
      else:
          img_input_feats = img_feats[:, 0 : img_feats.shape[1] // 2]
  
      if use_norm_score:
          img_input_feats = img_input_feats
      else:
          img_input_feats = img_input_feats / np.sqrt(
              np.sum(img_input_feats**2, -1, keepdims=True)
          )
  
      if use_detector_score:
          print(img_input_feats.shape, faceness_scores.shape)
          img_input_feats = (
              img_input_feats * faceness_scores[:, np.newaxis]
          )
      else:
          img_input_feats = img_input_feats
  
      template_norm_feats, unique_templates = image2template_feature(
          img_input_feats, templates, medias
      )
      stop = timeit.default_timer()
      print("Time: %.2f s. " % (stop - start))
  
      start = timeit.default_timer()
      score = verification(
          template_norm_feats, unique_templates, p1, p2
      )
      stop = timeit.default_timer()
      print("Time: %.2f s. " % (stop - start))
      result_dir = args.model_root
  
      save_path = os.path.join(
          result_dir, "{}_result".format(args.target)
      )
      if not os.path.exists(save_path):
          os.makedirs(save_path)
      score_save_file = os.path.join(
          save_path, "{}.npy".format(args.target)
      )
      np.save(score_save_file, score)
      files = [score_save_file]
      methods = []
      scores = []
      for file in files:
          methods.append(os.path.basename(file))
          scores.append(np.load(file))
      methods = np.array(methods)
      scores = dict(zip(methods, scores))
      x_labels = [
          10**-6,
          10**-5,
          10**-4,
          10**-3,
          10**-2,
          10**-1,
      ]
      tpr_fpr_table = prettytable.PrettyTable(
          ["Methods"] + [str(x) for x in x_labels]
      )
      for method in methods:
          fpr, tpr, _ = roc_curve(label, scores[method])
          fpr = np.flipud(fpr)
          tpr = np.flipud(tpr)
          tpr_fpr_row = []
          tpr_fpr_row.append("%s-%s" % (method, args.target))
          for fpr_iter in np.arange(len(x_labels)):
              _, min_index = min(
                  list(
                      zip(
                          abs(fpr - x_labels[fpr_iter]), range(len(fpr))
                      )
                  )
              )
              tpr_fpr_row.append("%.2f" % (tpr[min_index] * 100))
          tpr_fpr_table.add_row(tpr_fpr_row)
      print(tpr_fpr_table)
  
imports: import argparse
  import os
  import pickle
  import timeit
  import cv2
  import mxnet
  import numpy
  import pandas
  import prettytable
  import skimage.transform
  import torch
  from sklearn.metrics import roc_curve
  from sklearn.preprocessing import normalize
  from torch.utils.data import DataLoader
  from onnx_helper import ArcFaceORT
label_desc: Use image node_id 8 for calling a global function with example usage: main(args) without return types