code: def convert_raw_prediction(
      sample,
      raw_pred: dict,
      record: BaseRecord,
      detection_threshold: float,
      keep_image: bool = False,
  ):
      pred = faster_convert_raw_prediction(
          sample=sample,
          raw_pred=raw_pred,
          record=record,
          detection_threshold=detection_threshold,
          keep_image=keep_image,
      )
  
      above_threshold = pred.detection.above_threshold
      kps = raw_pred["keypoints"][above_threshold]
      keypoints = []
      for k in kps:
          k = k.cpu().numpy()
          k = list(chain.from_iterable(k))
          # `if sum(k) > 0` prevents empty `KeyPoints` objects to be instantiated.
          # E.g. `k = [0, 0, 0, 0, 0, 0]` is a flattened list of 2 points `(0, 0, 0)` and `(0, 0, 0)`. We don't want a `KeyPoints` object to be created on top of this list.
          if sum(k) > 0:
              keypoints.append(KeyPoints.from_xyv(k, None))
  
      pred.pred.add_component(KeyPointsRecordComponent())
      pred.pred.detection.add_keypoints(keypoints)
      pred.pred.detection.keypoints_scores = (
          raw_pred["keypoints_scores"][above_threshold]
          .detach()
          .cpu()
          .numpy()
      )
  
      return pred
  
file_path: icevision/icevision/models/torchvision/keypoint_rcnn/prediction.py
imports: from itertools import chain
  from icevision.imports import *
  from icevision.core import *
  from icevision.utils import *
  from icevision.data import *
  from icevision.models.utils import _predict_from_dl
  from icevision.models.torchvision.keypoint_rcnn.dataloaders import *
  from icevision.models.torchvision.faster_rcnn.prediction import convert_raw_prediction
label_desc: Use image node_id 5 for calling a global function with example usage: convert_raw_prediction(sample, raw_pred, record, detection_threshold, keep_image) and returns: pred