changeset 70:be24db3a4d6e

bug fix in reading pkl image list file
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Wed, 10 Feb 2010 00:38:54 -0500
parents 6d87c0df2b0e
children 22823acc1712 089f236759d9
files transformations/add_background_image.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/transformations/add_background_image.py	Tue Feb 09 22:17:37 2010 -0500
+++ b/transformations/add_background_image.py	Wed Feb 10 00:38:54 2010 -0500
@@ -16,8 +16,8 @@
         self.h = 32
         self.w = 32
         self.threshold = threshold;
-        self.bg_image_file = '/data/lisa/data/ift6266h10/image_net/filelist.pkl'
-        f=open(self.bg_image_file)
+        self.bg_image_file = '/data/lisa/data/ift6266h10/image_net/'
+        f=open(self.bg_image_file+'filelist.pkl')
         self.image_files = cPickle.load(f)
         f.close()
 
@@ -52,11 +52,11 @@
         x, y = random.randint(0, i_w - self.w), random.randint(0, i_h - self.h)
         return image[x:x + self.w, y:y + self.h]
 
-    # select a random background image from "bg_image_dir" and crops it
+    # select a random background image from "bg_image_file" and crops it
     def rand_bg_image(self):
         i = random.randint(0, len(self.image_files) - 1)
 
-        image = self.load_image(self.bg_image_dir + self.image_files[i])
+        image = self.load_image(self.bg_image_file + self.image_files[i])
         self.bg_image = self.rand_crop(image)
 
     # set "bg_image" as background to "image", based on a pixels threshold