code: def predict_with_given_det(
      image,
      det_res,
      keypoint_detector,
      keypoint_batch_size,
      run_benchmark,
  ):
      keypoint_res = {}
  
      (
          rec_images,
          records,
          det_rects,
      ) = keypoint_detector.get_person_from_rect(image, det_res)
  
      if len(det_rects) == 0:
          keypoint_res["keypoint"] = [[], []]
          return keypoint_res
  
      keypoint_vector = []
      score_vector = []
  
      rect_vector = det_rects
      keypoint_results = keypoint_detector.predict_image(
          rec_images, run_benchmark, repeats=10, visual=False
      )
      keypoint_vector, score_vector = translate_to_ori_images(
          keypoint_results, np.array(records)
      )
      keypoint_res["keypoint"] = (
          [keypoint_vector.tolist(), score_vector.tolist()]
          if len(keypoint_vector) > 0
          else [[], []]
      )
      keypoint_res["bbox"] = rect_vector
      return keypoint_res
  
imports: import os
  import json
  import cv2
  import math
  import numpy
  import paddle
  import yaml
  from det_keypoint_unite_utils import argsparser
  from preprocess import decode_image
  from infer import Detector, DetectorPicoDet, PredictConfig, print_arguments, get_test_images, bench_log
  from keypoint_infer import KeyPointDetector, PredictConfig_KeyPoint
  from visualize import visualize_pose
  from benchmark_utils import PaddleInferBenchmark
  from utils import get_current_memory_mb
  from keypoint_postprocess import translate_to_ori_images
label_desc: Use image node_id 1 for calling a global function with example usage: predict_with_given_det(image, det_res, keypoint_detector, keypoint_batch_size, run_benchmark) and returns: keypoint_res, keypoint_res