# HG changeset patch # User James Bergstra # Date 1282332508 14400 # Node ID c96dc085b5b7afa8136c9bcd3c9681fed4062a3f # Parent 90e11d5d0a4123ddd006897071a06e77b63ec293 image_patches - returning image stack in conventional order diff -r 90e11d5d0a41 -r c96dc085b5b7 pylearn/datasets/image_patches.py --- a/pylearn/datasets/image_patches.py Fri Aug 20 13:58:56 2010 -0400 +++ b/pylearn/datasets/image_patches.py Fri Aug 20 15:28:28 2010 -0400 @@ -56,7 +56,7 @@ #TODO: a pca_load_dataset function that loads the data, as projected onto principle components def olshausen_field_1996_whitened_images(path=None): - """Returns a (512,512,10) ndarray containing 10 whitened images. + """Returns a (10,512,512) ndarray containing 10 whitened images. The images are in floating point. Whitening was done by the paper authors, with band-pass whitening I think. @@ -66,10 +66,10 @@ 'original', 'IMAGES.mat') images = scipy.io.loadmat(path)['IMAGES'] assert images.shape == (512,512,10) - return images.astype('float32') + return images.astype('float32').transpose([2,0,1]) def olshausen_field_1996_raw_images(path=None): - """Returns a (512,512,10) ndarray containing 10 images. + """Returns a (10,512,512) ndarray containing 10 images. The images are in floating point. """ @@ -78,7 +78,7 @@ 'original', 'IMAGES_RAW.mat') images = scipy.io.loadmat(path)['IMAGES_RAW'] assert images.shape == (512,512,10) - return images.astype('float32') + return images.astype('float32').transpose([2,0,1]) def extract_random_patches(img_stack, N, R,C, rng): """Return subimages from the img_stack