SHARE
TWEET

Untitled

a guest Jan 15th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Keras: flow_from_directory")
  2.  
  3. start_mem = psutil.virtual_memory().used
  4. start_time = time.time()
  5.  
  6. datagen = ImageDataGenerator(rescale=1./255)
  7. train_generator = datagen.flow_from_directory('flowers', target_size=(128,128), batch_size=32)
  8. print("PRE-TIME", time.time() - start_time)
  9.  
  10. start_time = time.time()
  11.  
  12. step = 0
  13. for x_batch, y_batch in train_generator:
  14.     step += 1
  15.     if step > STEPS: break
  16.  
  17. print("TIME", time.time() - start_time)
  18.  
  19. curr_mem = psutil.virtual_memory().used
  20. print("Memory Used: %.2f GB" % ((curr_mem - start_mem) / GB))
  21.  
  22. # Release unused memory
  23.  
  24. dataset = None
  25. gc.collect()
  26. time.sleep(5)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top