# HG changeset patch # User Xavier Glorot # Date 1265780334 18000 # Node ID be24db3a4d6ec6746be258f733e5ed93f0931a20 # Parent 6d87c0df2b0eff5e9bdfa8dc6b0d7d2ff017fde5 bug fix in reading pkl image list file diff -r 6d87c0df2b0e -r be24db3a4d6e transformations/add_background_image.py --- 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