Advertisement
dan-masek

Untitled

May 8th, 2016
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import numpy as np
  2. import time
  3.  
  4.  
  5. test_image = (np.random.rand(1080,1920,3) * 255).astype('uint8')
  6.  
  7. print np.unique(test_image)
  8. exit()
  9.  
  10.  
  11. deltas = [0.0, 0.0, 0.0, 0.0]
  12.  
  13. ITER_COUNT = 5
  14.  
  15. for i in range(ITER_COUNT):
  16. t1 = time.time()
  17. im=test_image.reshape(1,-1,3)
  18. t2 = time.time()
  19. im_list=im.tolist()
  20. t3 = time.time()
  21. im_tuples=map(tuple,im_list[0])
  22. t4 = time.time()
  23. im_set=set(im_tuples)
  24. t5 = time.time()
  25. deltas[0] += t2 - t1
  26. deltas[1] += t3 - t2
  27. deltas[2] += t4 - t3
  28. deltas[3] += t5 - t4
  29.  
  30. deltas[:] = [n / ITER_COUNT for n in deltas]
  31.  
  32. print deltas
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement