code: def flip_keypoints(
      keypoints, keypoint_flip_map, keypoint_coords, width
  ):
      """Left/right flip keypoint_coords. keypoints and keypoint_flip_map are
      accessible from get_keypoints().
      """
      flipped_kps = keypoint_coords.copy()
      for lkp, rkp in keypoint_flip_map.items():
          lid = keypoints.index(lkp)
          rid = keypoints.index(rkp)
          flipped_kps[:, :, lid] = keypoint_coords[:, :, rid]
          flipped_kps[:, :, rid] = keypoint_coords[:, :, lid]
  
      # Flip x coordinates
      flipped_kps[:, 0, :] = width - flipped_kps[:, 0, :] - 1
      # Maintain COCO convention that if visibility == 0, then x, y = 0
      inds = np.where(flipped_kps[:, 2, :] == 0)
      flipped_kps[inds[0], 0, inds[1]] = 0
      return flipped_kps
  
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 3 for calling a global function with example usage: flip_keypoints(keypoints, keypoint_flip_map, keypoint_coords, width) and returns: flipped_kps