Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #used to create the patches
- import numpy as np
- import h5py
- import patches
- fname = 'all_images.hdf5'
- patch_sizes = [(7, 7)]
- f = h5py.File(fname,'r')
- # List all groups
- print("Keys: %s" % f.keys())
- # Get the data
- X = f['X']
- y = f['y']
- print(X.shape)
- print(y.shape)
- # Get one row of 7x7 patches
- uniques, ids = np.unique(y, return_inverse=True)
- print(uniques)
- for patch_size in patch_sizes:
- fname = str(patch_size[0]) + "_" + str(patch_size[1])
- fname += ".data"
- fname += ".csv"
- # 4. Create patches.
- patches.save_patches(X, y, fname, patch_size, ignore_class=0)
- f.close()
Add Comment
Please, Sign In to add comment