code: def yolo_head(feats, anchors, num_classes, input_shape):
      """Convert final layer features to bounding box parameters."""
      num_anchors = len(anchors)
      # Reshape to batch, height, width, num_anchors, box_params.
      anchors_tensor = K.reshape(
          K.constant(anchors), [1, 1, 1, num_anchors, 2]
      )
  
      conv_dims = K.shape(feats)[1:3]
      conv_height_index = K.arange(0, stop=conv_dims[1])
      conv_width_index = K.arange(0, stop=conv_dims[0])
      conv_height_index = K.tile(conv_height_index, [conv_dims[0]])
  
      conv_width_index = K.tile(
          K.expand_dims(conv_width_index, 0), [conv_dims[1], 1]
      )
      conv_width_index = K.flatten(K.transpose(conv_width_index))
      conv_index = K.transpose(
          K.stack([conv_height_index, conv_width_index])
      )
      conv_index = K.reshape(
          conv_index, [1, conv_dims[0], conv_dims[1], 1, 2]
      )
      conv_index = K.cast(conv_index, K.dtype(feats))
  
      feats = K.reshape(
          feats,
          [
              -1,
              conv_dims[0],
              conv_dims[1],
              num_anchors,
              num_classes + 5,
          ],
      )
      conv_dims = K.cast(conv_dims[::-1], K.dtype(feats))
  
      box_xy = K.sigmoid(feats[..., :2])
      box_wh = K.exp(feats[..., 2:4])
      box_confidence = K.sigmoid(feats[..., 4:5])
      box_class_probs = K.sigmoid(feats[..., 5:])
  
      # Adjust preditions to each spatial grid point and anchor size.
      # Note: YOLO iterates over height index before width index.
      # TODO: It works with +1, don't know why.
      box_xy = (box_xy + conv_index + 1) / conv_dims
      box_wh = (
          box_wh
          * anchors_tensor
          / K.cast(input_shape[::-1], K.dtype(box_wh))
      )
  
      return box_xy, box_wh, box_confidence, box_class_probs
  
file_path: MMdnn/mmdnn/conversion/examples/keras/utils.py
imports: import tensorflow
  from keras import backend
  from PIL import Image
label_desc: Use image node_id 2 for calling a global function with example usage: yolo_head(feats, anchors, num_classes, input_shape) and returns: box_xy,  box_wh,  box_confidence,  box_class_probs