Last active
August 22, 2017 22:25
-
-
Save zhreshold/3cacc3617973541b2a96f36798bd3768 to your computer and use it in GitHub Desktop.
Test mxnet image iter performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mxnet as mx | |
print(mx.__version__) | |
import time | |
import os | |
print('worker:', os.environ.get('MXNET_CPU_WORKER_NTHREADS', 1)) | |
num_batch = 100 | |
batch_size = 32 | |
data_shape = (3, 224, 224) | |
path = 'val.rec' | |
test_iter = mx.image.ImageIter(batch_size, data_shape, path_imgrec=path, rand_crop=True, rand_resize=True, rand_mirror=True, mean=True, std=True, brightness=0.1, contrast=0.1, saturation=0.1) | |
start = time.time() | |
count = 0 | |
for batch in test_iter: | |
mx.nd.waitall() | |
if count > num_batch: | |
break | |
count += 1 | |
print('elapsed', time.time() - start) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment