import numpy as np from timeit import default_timer as timer mask = np.load('mask.npy', allow_pickle=True) cell_mask_new_all = mask[:, :, :].astype(np.uint8) cell_mask_one = cell_mask_new_all[:,:,186] cell_mask_two = np.uint8(mask[:, :, 186]) t_1 = timer() image_cell_mask_one = cell_mask_one*255 t_2 = timer() print('image_cell_mask_one time:', t_2 - t_1) t_3 = timer() image_cell_mask_two = cell_mask_two*255 t_4 = timer() print('image_cell_mask_two time:', t_4 - t_3)I found a very interesting question. As you see, I use different code to get Cell_mask_one and Cell_mask_two, but the time of they multiply 255 is very difference.
I can not upload the img, and Write it out by hand。
t_1 = timer()
image_cell_mask_one = cell_mask_one*255
t_2 = timer()
print('image_cell_mask_one time:', t_2 - t_1)
0.04487754100409802
t_3 = timer()
image_cell_mask_two = cell_mask_two*255
t_4 = timer()
print('image_cell_mask_two time:', t_4 - t_3)
0.002681313009816222
The memory of data is almost 898mb,I can't upload here. I put the data at the google drive.
https://drive.google.com/file/d/1LyJxMiW...sp=sharing
Would you help me?Thanks.
Attached Files