comparison data_generation/pipeline/testtransformations.py @ 245:0de14b2034c6

change in testtransformation to test PNIST pipeline
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Tue, 16 Mar 2010 12:13:49 -0400
parents 5e0e5f1860ec
children
comparison
equal deleted inserted replaced
244:39421555993f 245:0de14b2034c6
26 from Occlusion import Occlusion 26 from Occlusion import Occlusion
27 from add_background_image import AddBackground 27 from add_background_image import AddBackground
28 from affine_transform import AffineTransformation 28 from affine_transform import AffineTransformation
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(False)]
32 32
33 ###---------------------complexity associated to each of them 33 ###---------------------complexity associated to each of them
34 complexity = 0.7 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.]
109 109
110 pygame.font.init() 110 pygame.font.init()
111 111
112 d = N.zeros((n,1024)) 112 d = N.zeros((n,1024))
113 113
114 datapath = '/data/lisa/data/ocr_breuel/filetensor/unlv-corrected-2010-02-01-shuffled.ft' 114 #datapath = '/data/lisa/data/ocr_breuel/filetensor/unlv-corrected-2010-02-01-shuffled.ft'
115 f = open(datapath) 115 #f = open(datapath)
116 d = ft.read(f) 116 #d = ft.read(f)
117 d = d[0:n,:]/255.0 117 #d = d[0:n,:]/255.0
118 createimage('/u/glorotxa/transf/OCR',d) 118 #createimage('/u/glorotxa/transf/OCR',d)
119 119
120 120
121 121
122 datapath = '/data/lisa/data/nist/by_class/' 122 datapath = '/data/lisa/data/nist/by_class/'
123 f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft') 123 f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft')
131 f = open(datapath+'upper/upper_train_data.ft') 131 f = open(datapath+'upper/upper_train_data.ft')
132 d = ft.read(f) 132 d = ft.read(f)
133 d = d[0:n,:]/255.0 133 d = d[0:n,:]/255.0
134 createimage('/u/glorotxa/transf/NIST_upper',d) 134 createimage('/u/glorotxa/transf/NIST_upper',d)
135 135
136 from Facade import * 136 #from Facade import *
137 137
138 for i in range(n): 138 #for i in range(n):
139 d[i,:]=N.asarray(N.reshape(generateCaptcha(0.8,0),(1,1024))/255.0,dtype='float32') 139 #d[i,:]=N.asarray(N.reshape(generateCaptcha(0.8,0),(1,1024))/255.0,dtype='float32')
140 140
141 createimage('/u/glorotxa/transf/capcha',d) 141 #createimage('/u/glorotxa/transf/capcha',d)
142 142
143 143
144 for i in range(n): 144 #for i in range(n):
145 myttf2jpg = ttf2jpg() 145 #myttf2jpg = ttf2jpg()
146 d[i,:]=N.reshape(myttf2jpg.generate_image()[0],(1,1024)) 146 #d[i,:]=N.reshape(myttf2jpg.generate_image()[0],(1,1024))
147 createimage('/u/glorotxa/transf/fonts',d) 147 #createimage('/u/glorotxa/transf/fonts',d)
148 148
149 datapath = '/data/lisa/data/nist/by_class/' 149 datapath = '/data/lisa/data/nist/by_class/'
150 f = open(datapath+'lower/lower_train_data.ft') 150 f = open(datapath+'lower/lower_train_data.ft')
151 d = ft.read(f) 151 d = ft.read(f)
152 d = d[0:n,:]/255.0 152 d = d[0:n,:]/255.0