code: def get_max_preds(batch_heatmaps):
      """
      Get predictions from score maps.
  
      Args:
          batch_heatmaps (numpy.ndarray): output of the network, with shape [N, C, H, W]
      """
      assert isinstance(
          batch_heatmaps, np.ndarray
      ), "batch_heatmaps should be numpy.ndarray"
      assert batch_heatmaps.ndim == 4, "batch_images should be 4-ndim"
  
      batch_size = batch_heatmaps.shape[0]
      num_joints = batch_heatmaps.shape[1]
      width = batch_heatmaps.shape[3]
      heatmaps_reshaped = batch_heatmaps.reshape(
          (batch_size, num_joints, -1)
      )
      idx = np.argmax(heatmaps_reshaped, 2)
      maxvals = np.amax(heatmaps_reshaped, 2)
      maxvals = maxvals.reshape((batch_size, num_joints, 1))
      idx = idx.reshape((batch_size, num_joints, 1))
      preds = np.tile(idx, (1, 1, 2)).astype(np.float32)
      preds[:, :, 0] = (preds[:, :, 0]) % width
      preds[:, :, 1] = np.floor((preds[:, :, 1]) / width)
      pred_mask = np.tile(np.greater(maxvals, 0.0), (1, 1, 2))
      pred_mask = pred_mask.astype(np.float32)
      preds *= pred_mask
      return preds, maxvals
  
file_path: PaddleHub/modules/image/keypoint_detection/human_pose_estimation_resnet50_mpii/processor.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import base64
  import os
  import time
  from collections import OrderedDict
  import cv2
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: get_max_preds(batch_heatmaps) and returns: preds,  maxvals