daily pastebin goal
78%
SHARE
TWEET

Untitled

a guest Nov 14th, 2018 71 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #used to create the patches
  2.  
  3. import numpy as np
  4. import h5py
  5. import patches
  6.  
  7. fname = 'all_images.hdf5'
  8. patch_sizes = [(7, 7)]
  9.  
  10. f = h5py.File(fname,'r')
  11.  
  12. # List all groups
  13. print("Keys: %s" % f.keys())
  14.  
  15. # Get the data
  16. X = f['X']
  17. y = f['y']
  18.  
  19. print(X.shape)
  20. print(y.shape)
  21.  
  22. # Get one row of 7x7 patches
  23.  
  24. uniques, ids = np.unique(y, return_inverse=True)
  25.  
  26. print(uniques)
  27.  
  28. for patch_size in patch_sizes:
  29.     fname = str(patch_size[0]) + "_" + str(patch_size[1])
  30.     fname += ".data"
  31.     fname += ".csv"
  32.  
  33.     # 4. Create patches.
  34.     patches.save_patches(X, y, fname, patch_size, ignore_class=0)
  35.  
  36. f.close()
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