# HG changeset patch # User Xavier Glorot # Date 1265832564 18000 # Node ID c32a968851f5197f53fae645d85a146746e1b50c # Parent 95c491bb56620d9b5128b3b14e100a5d0eba72c2# Parent 9936c4886299a1471656ead78bff8395521a63dd merge diff -r 9936c4886299 -r c32a968851f5 transformations/add_background_image.py --- a/transformations/add_background_image.py Wed Feb 10 14:51:18 2010 -0500 +++ b/transformations/add_background_image.py Wed Feb 10 15:09:24 2010 -0500 @@ -16,8 +16,12 @@ self.h = 32 self.w = 32 self.threshold = threshold; - self.bg_image_file = '/data/lisa/data/ift6266h10/image_net/' - f=open(self.bg_image_file+'filelist.pkl') + try: #in order to load locally if it is available + self.bg_image_file = '/Tmp/image_net/' + f=open(self.bg_image_file+'filelist.pkl') + except: + 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() diff -r 9936c4886299 -r c32a968851f5 transformations/pipeline.py --- a/transformations/pipeline.py Wed Feb 10 14:51:18 2010 -0500 +++ b/transformations/pipeline.py Wed Feb 10 15:09:24 2010 -0500 @@ -42,13 +42,14 @@ pylab.ion() #from add_background_image import AddBackground -#from affine_transform import AffineTransformation +from affine_transform import AffineTransformation from PoivreSel import PoivreSel from thick import Thick -#from BruitGauss import BruitGauss -#from gimp_script import GIMPTransformation -#from Rature import Rature +from BruitGauss import BruitGauss +from gimp_script import GIMP1 +from Rature import Rature from contrast import Contrast +from Occlusion import Occlusion from local_elastic_distortions import LocalElasticDistorter from slant import Slant @@ -59,7 +60,7 @@ # AFTER_EACH_MODULE_HOOK list (but not both, it's redundant) VISUALIZER = Visualizer(to_dir=DEBUG_OUTPUT_DIR, on_screen=False) -MODULE_INSTANCES = [LocalElasticDistorter()] +MODULE_INSTANCES = [Thick(),Slant(),GIMP1(),AffineTransformation(),LocalElasticDistorter(),Occlusion(),Rature(),Contrast()] # These should have a "after_transform_callback(self, image)" method # (called after each call to transform_image in a module) diff -r 9936c4886299 -r c32a968851f5 transformations/testtransformations.py --- a/transformations/testtransformations.py Wed Feb 10 14:51:18 2010 -0500 +++ b/transformations/testtransformations.py Wed Feb 10 15:09:24 2010 -0500 @@ -15,20 +15,22 @@ from BruitGauss import BruitGauss from DistorsionGauss import DistorsionGauss from PermutPixel import PermutPixel -#from gimp_script import GIMPTransformation +#from gimp_script import GIMP1 from Rature import Rature from contrast import Contrast from local_elastic_distortions import LocalElasticDistorter from slant import Slant -#from Occlusion import Occlusion +from Occlusion import Occlusion from add_background_image import AddBackground from affine_transform import AffineTransformation ###---------------------order of transformation module -MODULE_INSTANCES = [Thick(),Slant(),AffineTransformation(), LocalElasticDistorter(), PermutPixel(), Rature(), BruitGauss(),PoivreSel(), Contrast()] +MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(), PermutPixel(), Rature(), Occlusion(), BruitGauss(),PoivreSel(),AddBackground(), Contrast()] ###---------------------complexity associated to each of them -complexity = [0.6,0.7,0.5,0.4,0.1,0.5,0.03,0.03,0.5] +complexity = [0.5,0.6,0.5,0.4,0.1,0.5,0.5,0.5,0.5,0.5,0.5] +complexity = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.] + nbmodule = len(MODULE_INSTANCES) @@ -42,7 +44,7 @@ pygame.surfarray.use_arraytype('numpy') pygame.display.init() -screen = pygame.display.set_mode((4*(nbmodule+1)*32,4*32+20),0,8) +screen = pygame.display.set_mode((4*(nbmodule+1)/2*32,2*(4*32+20)),0,8) anglcolorpalette=[(x,x,x) for x in xrange(0,256)] screen.set_palette(anglcolorpalette) @@ -59,6 +61,7 @@ screen.blit(new,(0,0)) offset = 4*32 + offset2 = 0 ct = 0 for j in MODULE_INSTANCES: #max dilation @@ -73,11 +76,15 @@ new=pygame.transform.scale2x(new) new=pygame.transform.scale2x(new) new.set_palette(anglcolorpalette) - screen.blit(new,(offset,0)) + screen.blit(new,(offset,offset2)) font = pygame.font.SysFont('liberationserif',18) text = font.render(j.__module__,0,(255,255,255),(0,0,0)) - screen.blit(text,(offset,4*32)) - offset += 4*32 + screen.blit(text,(offset,offset2+4*32)) + if ct == len(MODULE_INSTANCES)/2-1: + offset = 0 + offset2 = 4*32+20 + else: + offset += 4*32 ct+=1 pygame.display.update() raw_input('Press Enter')