code: def result_to_json(image, pred_bbox):
      image_h, image_w, _ = image.shape
      out_boxes, out_scores, out_classes, num_boxes = pred_bbox
      class_names = {}
      json_result = []
      with open("model/coco.names", "r") as data:
          for ID, name in enumerate(data):
              class_names[ID] = name.strip("\n")
      nums_class = len(class_names)
  
      for i in range(num_boxes[0]):
          if (
              int(out_classes[0][i]) < 0
              or int(out_classes[0][i]) > nums_class
          ):
              continue
          coor = out_boxes[0][i]
          coor[0] = int(coor[0] * image_h)
          coor[2] = int(coor[2] * image_h)
          coor[1] = int(coor[1] * image_w)
          coor[3] = int(coor[3] * image_w)
  
          score = float(out_scores[0][i])
          class_ind = int(out_classes[0][i])
          bbox = np.array(
              [coor[1], coor[0], coor[3], coor[2]]
          ).tolist()  # [x1,y1,x2,y2]
          json_result.append(
              {
                  "image": None,
                  "category_id": class_ind,
                  "bbox": bbox,
                  "score": score,
              }
          )
  
      return json_result
  
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 10 for calling a global function with example usage: result_to_json(image, pred_bbox) and returns: json_result