Skip to content

Instantly share code, notes, and snippets.

@virtualdvid
Created January 15, 2019 19:27
Show Gist options
  • Save virtualdvid/805f5fc328190ee9418dc8320018bdf7 to your computer and use it in GitHub Desktop.
Save virtualdvid/805f5fc328190ee9418dc8320018bdf7 to your computer and use it in GitHub Desktop.
Gap: Flow from directory with Augmentation
print("Gap: Flow from directory with Augmentation")
dataset = Images(augment=['rotate=-30,30'], config=['stream'])
dataset.load('flowers')
dataset.minibatch = 32
train_generator = dataset.minibatch
start_mem = psutil.virtual_memory().used
start_time = time.time()
step = 0
for x_batch, y_batch in train_generator:
step += 1
if step > STEPS: break
print("TIME", time.time() - start_time)
curr_mem = psutil.virtual_memory().used
print("Memory Used: %.2f GB" % ((curr_mem - start_mem) / GB))
# Release unused memory
dataset = None
gc.collect()
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment