Mercurial > ift6266
comparison transformations/testtransformations.py @ 120:5e00ed18ae32
changed some transformation paramters to better fit with visualization
author | Xavier Glorot <glorotxa@iro.umontreal.ca> |
---|---|
date | Wed, 17 Feb 2010 17:45:48 -0500 |
parents | 0d083964af4b |
children | a507adba0ce3 |
comparison
equal
deleted
inserted
replaced
119:4f37755d301b | 120:5e00ed18ae32 |
---|---|
29 | 29 |
30 ###---------------------order of transformation module | 30 ###---------------------order of transformation module |
31 MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(),Rature(),Occlusion(), PermutPixel(),DistorsionGauss(),AddBackground(), PoivreSel(), BruitGauss(), Contrast()] | 31 MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(),Rature(),Occlusion(), PermutPixel(),DistorsionGauss(),AddBackground(), PoivreSel(), BruitGauss(), Contrast()] |
32 | 32 |
33 ###---------------------complexity associated to each of them | 33 ###---------------------complexity associated to each of them |
34 complexity = 0.6 | 34 complexity = 0.7 |
35 #complexity = [0.5]*len(MODULE_INSTANCES) | 35 #complexity = [0.5]*len(MODULE_INSTANCES) |
36 #complexity = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.] | 36 #complexity = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.] |
37 n=100 | 37 n=100 |
38 | 38 |
39 def createimage(path,d): | 39 def createimage(path,d): |
107 | 107 |
108 pygame.font.init() | 108 pygame.font.init() |
109 | 109 |
110 d = N.zeros((n,1024)) | 110 d = N.zeros((n,1024)) |
111 | 111 |
112 | |
113 datapath = '/data/lisa/data/nist/by_class/' | |
114 f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft') | |
115 d = ft.read(f) | |
116 d = d[0:n,:]/255.0 | |
117 createimage('/u/glorotxa/transf/NIST_digits',d) | |
118 | |
119 from Facade import * | 112 from Facade import * |
120 | 113 |
121 for i in range(n): | 114 for i in range(n): |
122 d[i,:]=N.asarray(N.reshape(generateCaptcha(0.5,0),(1,1024))/255.0,dtype='float32') | 115 d[i,:]=N.asarray(N.reshape(generateCaptcha(0.8,0),(1,1024))/255.0,dtype='float32') |
123 | 116 |
124 createimage('/u/glorotxa/transf/capcha',d) | 117 createimage('/u/glorotxa/transf/capcha',d) |
125 | 118 |
126 | 119 |
127 for i in range(n): | 120 for i in range(n): |
128 myttf2jpg = ttf2jpg() | 121 myttf2jpg = ttf2jpg() |
129 d[i,:]=N.reshape(myttf2jpg.generate_image()[0],(1,1024)) | 122 d[i,:]=N.reshape(myttf2jpg.generate_image()[0],(1,1024)) |
130 createimage('/u/glorotxa/transf/fonts',d) | 123 createimage('/u/glorotxa/transf/fonts',d) |
131 | 124 |
125 | |
126 datapath = '/data/lisa/data/nist/by_class/' | |
127 f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft') | |
128 d = ft.read(f) | |
129 d = d[0:n,:]/255.0 | |
130 createimage('/u/glorotxa/transf/NIST_digits',d) | |
132 | 131 |
133 | 132 |
134 datapath = '/data/lisa/data/nist/by_class/' | 133 datapath = '/data/lisa/data/nist/by_class/' |
135 f = open(datapath+'lower/lower_train_data.ft') | 134 f = open(datapath+'lower/lower_train_data.ft') |
136 d = ft.read(f) | 135 d = ft.read(f) |