code: def alpha_pose_image_cropper(
      source_img, boxes, scores, output_shape=(256, 192)
  ):
      if boxes is None:
          return None, boxes
  
      # crop person poses
      img_width, img_height = source_img.shape[1], source_img.shape[0]
  
      tensors = mx.nd.zeros(
          [boxes.shape[0], 3, output_shape[0], output_shape[1]]
      )
      out_boxes = np.zeros([boxes.shape[0], 4])
  
      for i, box in enumerate(boxes.asnumpy()):
          img = source_img.copy()
          box_width = box[2] - box[0]
          box_height = box[3] - box[1]
          if box_width > 100:
              scale_rate = 0.2
          else:
              scale_rate = 0.3
  
          # crop image
          left = int(max(0, box[0] - box_width * scale_rate / 2))
          up = int(max(0, box[1] - box_height * scale_rate / 2))
          right = int(
              min(
                  img_width - 1,
                  max(left + 5, box[2] + box_width * scale_rate / 2),
              )
          )
          bottom = int(
              min(
                  img_height - 1,
                  max(up + 5, box[3] + box_height * scale_rate / 2),
              )
          )
          crop_width = right - left
          if crop_width < 1:
              continue
          crop_height = bottom - up
          if crop_height < 1:
              continue
          ul = np.array((left, up))
          br = np.array((right, bottom))
          img = cv_cropBox(
              img, ul, br, output_shape[0], output_shape[1]
          )
  
          img = mx.nd.image.to_tensor(mx.nd.array(img))
          # img = img.transpose((2, 0, 1))
          img[0] = img[0] - 0.406
          img[1] = img[1] - 0.457
          img[2] = img[2] - 0.480
          assert img.shape[0] == 3
          tensors[i] = img
          out_boxes[i] = (left, up, right, bottom)
  
      return tensors, out_boxes
  
imports: from __future__ import absolute_import
  from __future__ import division
  import math
  import random
  import numpy
  import mxnet
  from mxnet import nd, image
  from mxnet.gluon.data.vision import transforms
  from ...utils.filesystem import try_import_cv2
label_desc: Use image node_id 25 for calling a global function with example usage: alpha_pose_image_cropper(source_img, boxes, scores, output_shape) and returns: tensors,  out_boxes, None,  boxes