code: def yolo_result(self, path):
      image = Image.fromarray(np.uint8(np.squeeze(self.data)))
  
      self.sess = K.get_session()
      self.boxes, self.scores, self.classes = self.generate()
      out_boxes, out_scores, out_classes = self.sess.run(
          [self.boxes, self.scores, self.classes],
          feed_dict={
              self.model.input: self.data / 255.0,
              self.input_image_shape: [608, 608],
              K.learning_phase(): 0,
          },
      )
      # print(out_boxes, out_scores, out_classes)
      print("Found {} boxes for {}".format(len(out_boxes), "img"))
  
      thickness = (image.size[0] + image.size[1]) // 300
  
      for i, c in reversed(list(enumerate(out_classes))):
          predicted_class = self.class_names[c]
          box = out_boxes[i]
          score = out_scores[i]
  
          label = "{} {:.2f}".format(predicted_class, score)
          draw = ImageDraw.Draw(image)
          label_size = draw.textsize(label)
  
          top, left, bottom, right = box
          top = max(0, np.floor(top + 0.5).astype("int32"))
          left = max(0, np.floor(left + 0.5).astype("int32"))
          bottom = min(
              image.size[1], np.floor(bottom + 0.5).astype("int32")
          )
          right = min(
              image.size[0], np.floor(right + 0.5).astype("int32")
          )
          print(label, (left, top), (right, bottom))
  
          if top - label_size[1] >= 0:
              text_origin = np.array([left, top - label_size[1]])
          else:
              text_origin = np.array([left, top + 1])
  
          # get random colors
          self.colors = []
          C = list(
              np.random.random_integers(
                  255, size=(len(self.class_names), 3)
              )
          )
          for i in C:
              self.colors.append(tuple(i))
  
          # My kingdom for a good redistributable image drawing library.
          for i in range(thickness):
              draw.rectangle(
                  [left + i, top + i, right - i, bottom - i],
                  outline=self.colors[c],
              )
          draw.rectangle(
              [tuple(text_origin), tuple(text_origin + label_size)],
              fill=self.colors[c],
          )
          draw.text(tuple(text_origin), label, fill=(0, 0, 0))
          del draw
      image.save("{}.jpg".format(path), "JPEG")
  
file_path: MMdnn/mmdnn/conversion/examples/keras/imagenet_test.py
imports: import argparse
  import numpy
  import sys
  import os
  from mmdnn.conversion.examples.imagenet_test import TestKit
  import colorsys
  from keras import backend
  from PIL import Image, ImageFont, ImageDraw
  from mmdnn.conversion.examples.keras.utils import yolo_eval
label_desc: Use image node_id 5 for calling the TestKeras obj's underlying member method code with example usage: obj.yolo_result(path) without return types