Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import time
- test_image = (np.random.rand(1080,1920,3) * 255).astype('uint8')
- print np.unique(test_image)
- exit()
- deltas = [0.0, 0.0, 0.0, 0.0]
- ITER_COUNT = 5
- for i in range(ITER_COUNT):
- t1 = time.time()
- im=test_image.reshape(1,-1,3)
- t2 = time.time()
- im_list=im.tolist()
- t3 = time.time()
- im_tuples=map(tuple,im_list[0])
- t4 = time.time()
- im_set=set(im_tuples)
- t5 = time.time()
- deltas[0] += t2 - t1
- deltas[1] += t3 - t2
- deltas[2] += t4 - t3
- deltas[3] += t5 - t4
- deltas[:] = [n / ITER_COUNT for n in deltas]
- print deltas
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement