changeset 968:c96dc085b5b7

image_patches - returning image stack in conventional order
author James Bergstra <bergstrj@iro.umontreal.ca>
date Fri, 20 Aug 2010 15:28:28 -0400
parents 90e11d5d0a41
children bc22f739b54c
files pylearn/datasets/image_patches.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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