Skip to content

Instantly share code, notes, and snippets.

@zhreshold
Last active August 22, 2017 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhreshold/3cacc3617973541b2a96f36798bd3768 to your computer and use it in GitHub Desktop.
Save zhreshold/3cacc3617973541b2a96f36798bd3768 to your computer and use it in GitHub Desktop.
Test mxnet image iter performance
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