code: def decode_tf(
      conv_output,
      output_size,
      NUM_CLASS,
      STRIDES,
      ANCHORS,
      i=0,
      XYSCALE=[1, 1, 1],
  ):
      batch_size = tf.shape(conv_output)[0]
      conv_output = tf.reshape(
          conv_output,
          (batch_size, output_size, output_size, 3, 5 + NUM_CLASS),
      )
  
      (
          conv_raw_dxdy,
          conv_raw_dwdh,
          conv_raw_conf,
          conv_raw_prob,
      ) = tf.split(conv_output, (2, 2, 1, NUM_CLASS), axis=-1)
  
      xy_grid = tf.meshgrid(
          tf.range(output_size), tf.range(output_size)
      )
      xy_grid = tf.expand_dims(
          tf.stack(xy_grid, axis=-1), axis=2
      )  # [gx, gy, 1, 2]
      xy_grid = tf.tile(
          tf.expand_dims(xy_grid, axis=0), [batch_size, 1, 1, 3, 1]
      )
  
      xy_grid = tf.cast(xy_grid, tf.float32)
  
      pred_xy = (
          (tf.sigmoid(conv_raw_dxdy) * XYSCALE[i])
          - 0.5 * (XYSCALE[i] - 1)
          + xy_grid
      ) * STRIDES[i]
      pred_wh = tf.exp(conv_raw_dwdh) * ANCHORS[i]
      pred_xywh = tf.concat([pred_xy, pred_wh], axis=-1)
  
      pred_conf = tf.sigmoid(conv_raw_conf)
      pred_prob = tf.sigmoid(conv_raw_prob)
  
      pred_prob = pred_conf * pred_prob
      pred_prob = tf.reshape(pred_prob, (batch_size, -1, NUM_CLASS))
      pred_xywh = tf.reshape(pred_xywh, (batch_size, -1, 4))
  
      return pred_xywh, pred_prob
  
file_path: TensorLayer/tensorlayer/app/computer_vision_object_detection/common.py
imports: import tensorflow
  import colorsys, random, cv2
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: decode_tf(conv_output, output_size, NUM_CLASS, STRIDES, ANCHORS, i, XYSCALE) and returns: pred_xywh,  pred_prob