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, 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
      use_dark(bool): whether to use postprocess in DarkPose
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",",","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","use_dark","(","bool",")",":","whether","to","use","postprocess","in","DarkPose"]
code: def postprocess(self, inputs, result):
      np_heatmap = result["heatmap"]
      np_masks = result["masks"]
      # postprocess output of predictor
      if (
          KEYPOINT_SUPPORT_MODELS[self.pred_config.arch]
          == "keypoint_bottomup"
      ):
          results = {}
          h, w = inputs["im_shape"][0]
          preds = [np_heatmap]
          if np_masks is not None:
              preds += np_masks
          preds += [h, w]
          keypoint_postprocess = HRNetPostProcess()
          kpts, scores = keypoint_postprocess(*preds)
          results["keypoint"] = kpts
          results["score"] = scores
          return results
      elif (
          KEYPOINT_SUPPORT_MODELS[self.pred_config.arch]
          == "keypoint_topdown"
      ):
          results = {}
          imshape = inputs["im_shape"][:, ::-1]
          center = np.round(imshape / 2.0)
          scale = imshape / 200.0
          keypoint_postprocess = HRNetPostProcess(
              use_dark=self.use_dark
          )
          kpts, scores = keypoint_postprocess(np_heatmap, center, scale)
          results["keypoint"] = kpts
          results["score"] = scores
          return results
      else:
          raise ValueError(
              "Unsupported arch: {}, expect {}".format(
                  self.pred_config.arch, KEYPOINT_SUPPORT_MODELS
              )
          )
  
imports: import math
  import os
  import cv2
  import numpy
  import yaml
  from .infer import Detector
  from .keypoint_postprocess import HRNetPostProcess
  from .keypoint_preprocess import expand_crop
  from .visualize import visualize_pose
label_desc: Use image node_id 4 for calling the KeyPointDetector obj's underlying member method code with example usage: obj.postprocess(inputs, result) and returns: results, results