class_docstr: Args:
      model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
      device (str): Choose the device you want to run, it can be: CPU/GPU/XPU/NPU, default is CPU
      run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
      batch_size (int): size of pre batch in inference
      trt_min_shape (int): min shape for dynamic shape in trt
      trt_max_shape (int): max shape for dynamic shape in trt
      trt_opt_shape (int): opt shape for dynamic shape in trt
      trt_calib_mode (bool): If the model is produced by TRT offline quantitative
          calibration, trt_calib_mode need to set True
      cpu_threads (int): cpu threads
      enable_mkldnn (bool): whether to open MKLDNN
      output_dir (str): The path of output
      threshold (float): The threshold of score for visualization
class_docstr_tok: ["Args",":","model_dir","(","str",")",":","root","path","of","model.pdiparams",",","model.pdmodel","and","infer_cfg.yml","device","(","str",")",":","Choose","the","device","you","want","to","run",",","it","can","be",":","CPU\/GPU\/XPU\/NPU",",","default","is","CPU","run_mode","(","str",")",":","mode","of","running","(","paddle\/trt_fp32\/trt_fp16",")","batch_size","(","int",")",":","size","of","pre","batch","in","inference","trt_min_shape","(","int",")",":","min","shape","for","dynamic","shape","in","trt","trt_max_shape","(","int",")",":","max","shape","for","dynamic","shape","in","trt","trt_opt_shape","(","int",")",":","opt","shape","for","dynamic","shape","in","trt","trt_calib_mode","(","bool",")",":","If","the","model","is","produced","by","TRT","offline","quantitative","calibration",",","trt_calib_mode","need","to","set","True","cpu_threads","(","int",")",":","cpu","threads","enable_mkldnn","(","bool",")",":","whether","to","open","MKLDNN","output_dir","(","str",")",":","The","path","of","output","threshold","(","float",")",":","The","threshold","of","score","for","visualization"]
code: def postprocess(self, inputs, result):
      # postprocess output of predictor
      im_results = result["output"]
  
      labels = self.pred_config.labels
      age_list = ["AgeLess18", "Age18-60", "AgeOver60"]
      direct_list = ["Front", "Side", "Back"]
      bag_list = ["HandBag", "ShoulderBag", "Backpack"]
      upper_list = [
          "UpperStride",
          "UpperLogo",
          "UpperPlaid",
          "UpperSplice",
      ]
      lower_list = [
          "LowerStripe",
          "LowerPattern",
          "LongCoat",
          "Trousers",
          "Shorts",
          "Skirt&Dress",
      ]
      glasses_threshold = 0.3
      hold_threshold = 0.6
      batch_res = []
      for res in im_results:
          res = res.tolist()
          label_res = []
          # gender
          gender = "Female" if res[22] > self.threshold else "Male"
          label_res.append(gender)
          # age
          age = age_list[np.argmax(res[19:22])]
          label_res.append(age)
          # direction
          direction = direct_list[np.argmax(res[23:])]
          label_res.append(direction)
          # glasses
          glasses = "Glasses: "
          if res[1] > glasses_threshold:
              glasses += "True"
          else:
              glasses += "False"
          label_res.append(glasses)
          # hat
          hat = "Hat: "
          if res[0] > self.threshold:
              hat += "True"
          else:
              hat += "False"
          label_res.append(hat)
          # hold obj
          hold_obj = "HoldObjectsInFront: "
          if res[18] > hold_threshold:
              hold_obj += "True"
          else:
              hold_obj += "False"
          label_res.append(hold_obj)
          # bag
          bag = bag_list[np.argmax(res[15:18])]
          bag_score = res[15 + np.argmax(res[15:18])]
          bag_label = bag if bag_score > self.threshold else "No bag"
          label_res.append(bag_label)
          # upper
          upper_label = "Upper:"
          sleeve = "LongSleeve" if res[3] > res[2] else "ShortSleeve"
          upper_label += " {}".format(sleeve)
          upper_res = res[4:8]
          if np.max(upper_res) > self.threshold:
              upper_label += " {}".format(
                  upper_list[np.argmax(upper_res)]
              )
          label_res.append(upper_label)
          # lower
          lower_res = res[8:14]
          lower_label = "Lower: "
          has_lower = False
          for i, l in enumerate(lower_res):
              if l > self.threshold:
                  lower_label += " {}".format(lower_list[i])
                  has_lower = True
          if not has_lower:
              lower_label += " {}".format(
                  lower_list[np.argmax(lower_res)]
              )
  
          label_res.append(lower_label)
          # shoe
          shoe = "Boots" if res[14] > self.threshold else "No boots"
          label_res.append(shoe)
  
          batch_res.append(label_res)
      result = {"output": batch_res}
      return result
  
imports: import os
  import yaml
  import glob
  from functools import reduce
  import cv2
  import numpy
  import math
  import paddle
  from paddle.inference import Config
  from paddle.inference import create_predictor
  import sys
  from python.benchmark_utils import PaddleInferBenchmark
  from python.preprocess import preprocess, Resize, NormalizeImage, Permute, PadStride, LetterBoxResize, WarpAffine
  from python.visualize import visualize_attr
  from python.utils import argsparser, Timer, get_current_memory_mb
  from python.infer import Detector, get_test_images, print_arguments, load_predictor
  from PIL import Image, ImageDraw, ImageFont
label_desc: Use image node_id 4 for calling the AttrDetector obj's underlying member method code with example usage: obj.postprocess(inputs, result) and returns: result