code: def decode_keypoints(outputs, origin_hw, num_joints: int = 17):
      keypoints = []
      scores = []
      heatmap_h, heatmap_w = outputs.shape[-2:]
      for i in range(num_joints):
          pt = np.unravel_index(
              np.argmax(outputs[i]), (heatmap_h, heatmap_w)
          )
          score = outputs[i, pt[0], pt[1]]
          keypoints.append(pt[::-1])  # hw -> wh(xy)
          scores.append(score)
  
      keypoints = np.array(keypoints, dtype=float)
      scores = np.array(scores, dtype=float)
      # convert to full image scale
      keypoints[:, 0] = np.clip(
          keypoints[:, 0] / heatmap_w * origin_hw[1],
          a_min=0,
          a_max=origin_hw[1],
      )
      keypoints[:, 1] = np.clip(
          keypoints[:, 1] / heatmap_h * origin_hw[0],
          a_min=0,
          a_max=origin_hw[0],
      )
      return keypoints, scores
  
imports: import math
  import random
  from typing import Tuple
  import cv2
  import numpy
  import torch
  from torchvision.transforms import functional
  import matplotlib.pyplot
label_desc: Use image node_id 6 for calling a global function with example usage: decode_keypoints(outputs, origin_hw, num_joints) and returns: keypoints,  scores