code: def compute_oks(src_keypoints, src_roi, dst_keypoints, dst_roi):
      """Compute OKS for predicted keypoints wrt gt_keypoints.
      src_keypoints: 4xK
      src_roi: 4x1
      dst_keypoints: Nx4xK
      dst_roi: Nx4
      """
  
      sigmas = (
          np.array(
              [
                  0.26,
                  0.25,
                  0.25,
                  0.35,
                  0.35,
                  0.79,
                  0.79,
                  0.72,
                  0.72,
                  0.62,
                  0.62,
                  1.07,
                  1.07,
                  0.87,
                  0.87,
                  0.89,
                  0.89,
              ]
          )
          / 10.0
      )
      vars = (sigmas * 2) ** 2
  
      # area
      src_area = (src_roi[2] - src_roi[0] + 1) * (
          src_roi[3] - src_roi[1] + 1
      )
  
      # measure the per-keypoint distance if keypoints visible
      dx = dst_keypoints[:, 0, :] - src_keypoints[0, :]
      dy = dst_keypoints[:, 1, :] - src_keypoints[1, :]
  
      e = (dx**2 + dy**2) / vars / (src_area + np.spacing(1)) / 2
      e = np.sum(np.exp(-e), axis=1) / e.shape[1]
  
      return e
  
file_path: dense-pose/detectron/utils/keypoints.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import cv2
  import numpy
  from detectron.core.config import cfg
  import detectron.utils.blob
label_desc: Use image node_id 9 for calling a global function with example usage: compute_oks(src_keypoints, src_roi, dst_keypoints, dst_roi) and returns: e