code: def get_postprocesser(video_width, video_height):
      with open("/trt_pose/tasks/human_pose/human_pose.json", "r") as f:
          human_pose = json.load(f)
      topology = trt_pose.coco.coco_category_to_topology(human_pose)
      parse_objects = ParseObjects(topology)
  
      def postprocess(cmap, paf):
          cmap, paf = cmap.detach().cpu(), paf.detach().cpu()
          counts, objects, peaks = parse_objects(cmap, paf)
  
          count = int(counts[0])
  
          detections = []
  
          for i in range(count):
              points = []
              scores = []
              obj = objects[0][i]
              C = obj.shape[0]
              for j in range(C):
                  k = int(obj[j])
  
                  if k >= 0:
                      peak = peaks[0][j][k]
                      x = float(peak[1]) * video_width
                      y = float(peak[0]) * video_height
  
                      points.append([x, y])
                      scores.append(1)
                  else:
                      points.append([0, 0])
                      scores.append(0)
  
              detections.append(
                  Detection(np.array(points), scores=np.array(scores))
              )
  
          return detections
  
      return postprocess
  
file_path: norfair/demos/profiling/src/utils.py
imports: import json
  import cv2
  import numpy
  import PIL.Image
  import torch
  import torch2trt
  import torchvision.transforms
  import trt_pose.coco
  import trt_pose.models
  from torch2trt import TRTModule
  from trt_pose.parse_objects import ParseObjects
  from norfair import Detection
  from norfair.distances import create_keypoints_voting_distance, create_normalized_mean_euclidean_distance
  from norfair.filter import FilterPyKalmanFilterFactory, NoFilterFactory, OptimizedKalmanFilterFactory
label_desc: Use image node_id 2 for calling a global function with example usage: get_postprocesser(video_width, video_height) and returns: postprocess, detections