Mercurial > ift6266
changeset 66:bf83682c827b
merge
author | Xavier Glorot <glorotxa@iro.umontreal.ca> |
---|---|
date | Tue, 09 Feb 2010 18:45:35 -0500 |
parents | ab70fbca513c (diff) 1afa95285b9c (current diff) |
children | 5e448ea129b3 |
files | |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/transformations/add_background_image.py Tue Feb 09 18:25:50 2010 -0500 +++ b/transformations/add_background_image.py Tue Feb 09 18:45:35 2010 -0500 @@ -15,8 +15,9 @@ self.h = 32 self.w = 32 self.threshold = threshold; - self.bg_image_dir = './images/' - self.pattern = '*.jpg' + self.bg_image_dir = '/data/lisa/data/ift6266h10/image_net/' + self.pattern = '*.JPEG' + self.image_files = fnmatch.filter(os.listdir(self.bg_image_dir),self.pattern) # get threshold value def get_settings_names(self): @@ -51,11 +52,9 @@ # select a random background image from "bg_image_dir" and crops it def rand_bg_image(self): - files = os.listdir(self.bg_image_dir) - image_files = fnmatch.filter(files, self.pattern) - i = random.randint(0, len(image_files) - 1) + i = random.randint(0, len(self.image_files) - 1) - image = self.load_image(self.bg_image_dir + image_files[i]) + image = self.load_image(self.bg_image_dir + self.image_files[i]) self.bg_image = self.rand_crop(image) # set "bg_image" as background to "image", based on a pixels threshold