code: def generateBoundingBox(imap, reg, scale, t):
      # use heatmap to generate bounding boxes
      stride = 2
      cellsize = 12
  
      imap = np.transpose(imap)
      dx1 = np.transpose(reg[:, :, 0])
      dy1 = np.transpose(reg[:, :, 1])
      dx2 = np.transpose(reg[:, :, 2])
      dy2 = np.transpose(reg[:, :, 3])
      y, x = np.where(imap >= t)
      if y.shape[0] == 1:
          dx1 = np.flipud(dx1)
          dy1 = np.flipud(dy1)
          dx2 = np.flipud(dx2)
          dy2 = np.flipud(dy2)
      score = imap[(y, x)]
      reg = np.transpose(
          np.vstack(
              [dx1[(y, x)], dy1[(y, x)], dx2[(y, x)], dy2[(y, x)]]
          )
      )
      if reg.size == 0:
          reg = np.empty((0, 3))
      bb = np.transpose(np.vstack([y, x]))
      q1 = np.fix((stride * bb + 1) / scale)
      q2 = np.fix((stride * bb + cellsize - 1 + 1) / scale)
      boundingbox = np.hstack([q1, q2, np.expand_dims(score, 1), reg])
      return boundingbox, reg
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  import cv2
  import os
  import inspect
label_desc: Use image node_id 6 for calling a global function with example usage: generateBoundingBox(imap, reg, scale, t) and returns: boundingbox,  reg