SHARE
TWEET

Untitled

a guest Mar 26th, 2018 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. import cv2
  3. import time
  4.  
  5. IM_SIZE = 224
  6.  
  7. print("LOADING....")
  8. net = cv2.dnn.readNetFromCaffe('channel_pruning_VGG-16_3C4x.prototxt', 'channel_pruning_VGG-16_3C4x.caffemodel')
  9. print("LOADED")
  10.  
  11. sum_t = 0
  12. num_runs = 10
  13. for i in range(num_runs):
  14.     x_image = np.asarray(np.random.rand(IM_SIZE, IM_SIZE, 3), dtype=np.float32)
  15.     t = time.time()
  16.     inputBlob = cv2.dnn.blobFromImage(x_image) 
  17.     net.setInput(inputBlob)
  18.     result = net.forward()
  19.     sum_t += time.time()-t
  20.  
  21. print("Inference done in {}s".format(sum_t/num_runs))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top