changeset 1458:31d8c6a0a70d

fixed backward logic regarding shuffled in tinyimages_op
author James Bergstra <bergstrj@iro.umontreal.ca>
date Mon, 04 Apr 2011 23:40:06 -0400
parents 9d941cd77479
children 509d6669429d
files pylearn/dataset_ops/tinyimages.py pylearn/datasets/tinyimages.py
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dataset_ops/tinyimages.py	Mon Apr 04 23:22:18 2011 -0400
+++ b/pylearn/dataset_ops/tinyimages.py	Mon Apr 04 23:40:06 2011 -0400
@@ -45,9 +45,9 @@
     if loop:
         s_idx = s_idx % tinyimages.n_images
     if shuffled:
-        fn = tinyimages.get_memmapped_file
+        fn = tinyimages.get_shuffled_memmapped_file
     else:
-        fn = tinyimages.get_shuffled_memmapped_file
+        fn = tinyimages.get_memmapped_file
     op = TensorFnDataset('uint8',
             bcast=(False, False, False),
             fn=fn,
--- a/pylearn/datasets/tinyimages.py	Mon Apr 04 23:22:18 2011 -0400
+++ b/pylearn/datasets/tinyimages.py	Mon Apr 04 23:40:06 2011 -0400
@@ -88,17 +88,18 @@
         i +=1
 
 
-def arrange_first_N_into_tiling(R,C, filename):
+def arrange_first_N_into_tiling(R,C, fileroot):
     R=int(R)
     C=int(C)
-    if 1:
-        A = numpy.asarray([i.copy() for i,ii in zip(image_generator(), xrange(R*C))])
-    elif 0:
-        A = get_memmapped_file(R*C)
-    else:
-        A = get_shuffled_memmapped_file(R*C)
+    A = numpy.asarray([i.copy() for i,ii in zip(image_generator(), xrange(R*C))])
+    pylearn.io.image_tiling.tile_slices_to_image_uint8(A,
+            tile_shape=(R,C)).save(fileroot+'_from_imgs.png')
+    A = get_memmapped_file(R*C)
     pylearn.io.image_tiling.tile_slices_to_image_uint8(A,
-            tile_shape=(R,C)).save(filename)
+            tile_shape=(R,C)).save(fileroot+'_memmapped.png')
+    A = get_shuffled_memmapped_file(R*C)
+    pylearn.io.image_tiling.tile_slices_to_image_uint8(A,
+            tile_shape=(R,C)).save(fileroot+'_shuffled.png')
 
 
 n_images = 1608356