code: def perf(model_path, batch_size, iteration):
      batch_input = np.random.rand(batch_size, 3, 224, 224)
      single_input = np.random.rand(1, 3, 224, 224)
      init_engine()
  
      model = ImageClassifier.load_model(model_path)
      model.set_evaluate_status()
  
      for i in range(iteration):
          start = time.time_ns()
          model.forward(batch_input)
          time_used = time.time_ns() - start
          throughput = round(batch_size / (time_used / 10**9), 2)
          print(
              "Iteration:"
              + str(i)
              + ", batch "
              + str(batch_size)
              + ", takes "
              + str(time_used)
              + " ns"
              + ", throughput is "
              + str(throughput)
              + " imgs/sec"
          )
  
      # mkldnn model would forward a fixed batch size.
      # Thus need a new model to test for latency.
      model2 = ImageClassifier.load_model(model_path)
      model2.set_evaluate_status()
  
      for i in range(iteration):
          start = time.time_ns()
          model.forward(single_input)
          latency = time.time_ns() - start
          print(
              "Iteration:"
              + str(i)
              + ", latency for a single image is "
              + str(latency / 10**6)
              + " ms"
          )
  
imports: import sys
  from zoo.models.image.imageclassification import ImageClassifier
  from bigdl.util.common import init_engine
  from optparse import OptionParser
  import numpy
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: perf(model_path, batch_size, iteration) without return types