Created
October 19, 2015 11:53
-
-
Save andykitchen/0aecd5d30b20c5c64ec6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w = 96 | |
n = 20000 | |
l = 32 | |
def rand_ranges(a, b, l, size): | |
r = np.repeat(np.arange(l, dtype=np.intp)[np.newaxis], size, axis=0) | |
r += np.random.randint(a, b-l, size=size)[:,np.newaxis] | |
return r | |
si0 = np.random.randint(0, images.shape[0], size=n) | |
si1 = rand_ranges(0, w, l, size=n); | |
si2 = rand_ranges(0, w, l, size=n); | |
i5 = ( | |
si0.reshape(n, 1, 1), | |
si1.reshape(n, l, 1), | |
si2.reshape(n, 1, l) | |
) | |
patches = zca_images[i5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment