code: def get_detections(im, det, thresh, names, classes):
      "Draw the markings around the detected region"
      labelstr = []
      category = -1
      detection = None
      valid = False
      for j in range(classes):
          if det["prob"][j] > thresh:
              if category == -1:
                  category = j
              labelstr.append(
                  names[j] + " " + str(round(det["prob"][j], 4))
              )
  
      if category > -1:
          valid = True
          imc, imh, imw = im.shape
          width = int(imh * 0.006)
          offset = category * 123457 % classes
          red = _get_color(2, offset, classes)
          green = _get_color(1, offset, classes)
          blue = _get_color(0, offset, classes)
          rgb = [red, green, blue]
          b = det["bbox"]
          left = int((b.x - b.w / 2.0) * imw)
          right = int((b.x + b.w / 2.0) * imw)
          top = int((b.y - b.h / 2.0) * imh)
          bot = int((b.y + b.h / 2.0) * imh)
  
          if left < 0:
              left = 0
          if right > imw - 1:
              right = imw - 1
          if top < 0:
              top = 0
          if bot > imh - 1:
              bot = imh - 1
  
          detection = {
              "category": category,
              "labelstr": labelstr,
              "left": left,
              "top": top,
              "right": right,
              "bot": bot,
              "width": width,
              "rgb": rgb,
          }
  
      return valid, detection
  
imports: from __future__ import division
  import math
  from collections import namedtuple
  from functools import cmp_to_key
  import numpy
label_desc: Use image node_id 12 for calling a global function with example usage: get_detections(im, det, thresh, names, classes) and returns: valid,  detection