changeset 246:2024368a8d3d

merge
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Tue, 16 Mar 2010 12:14:10 -0400
parents 0de14b2034c6 (diff) 3c54cb3713ef (current diff)
children 4d109b648c31 dd2df78fcf47
files
diffstat 2 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/data_generation/pipeline/testtransformations.py	Tue Mar 16 12:01:31 2010 -0400
+++ b/data_generation/pipeline/testtransformations.py	Tue Mar 16 12:14:10 2010 -0400
@@ -28,7 +28,7 @@
 from affine_transform import AffineTransformation
 
 ###---------------------order of transformation module
-MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(),Rature(),Occlusion(), PermutPixel(),DistorsionGauss(),AddBackground(), PoivreSel(), BruitGauss(), Contrast()]
+MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(False)]
 
 ###---------------------complexity associated to each of them
 complexity = 0.7
@@ -111,11 +111,11 @@
 
 d = N.zeros((n,1024))
 
-datapath = '/data/lisa/data/ocr_breuel/filetensor/unlv-corrected-2010-02-01-shuffled.ft'
-f = open(datapath)
-d = ft.read(f)
-d = d[0:n,:]/255.0
-createimage('/u/glorotxa/transf/OCR',d)
+#datapath = '/data/lisa/data/ocr_breuel/filetensor/unlv-corrected-2010-02-01-shuffled.ft'
+#f = open(datapath)
+#d = ft.read(f)
+#d = d[0:n,:]/255.0
+#createimage('/u/glorotxa/transf/OCR',d)
 
 
 
@@ -133,18 +133,18 @@
 d = d[0:n,:]/255.0
 createimage('/u/glorotxa/transf/NIST_upper',d)
 
-from Facade import *
+#from Facade import *
 
-for i in range(n):
-    d[i,:]=N.asarray(N.reshape(generateCaptcha(0.8,0),(1,1024))/255.0,dtype='float32')
+#for i in range(n):
+    #d[i,:]=N.asarray(N.reshape(generateCaptcha(0.8,0),(1,1024))/255.0,dtype='float32')
 
-createimage('/u/glorotxa/transf/capcha',d)
+#createimage('/u/glorotxa/transf/capcha',d)
 
 
-for i in range(n):
-    myttf2jpg = ttf2jpg()
-    d[i,:]=N.reshape(myttf2jpg.generate_image()[0],(1,1024))
-createimage('/u/glorotxa/transf/fonts',d)
+#for i in range(n):
+    #myttf2jpg = ttf2jpg()
+    #d[i,:]=N.reshape(myttf2jpg.generate_image()[0],(1,1024))
+#createimage('/u/glorotxa/transf/fonts',d)
 
 datapath = '/data/lisa/data/nist/by_class/'
 f = open(datapath+'lower/lower_train_data.ft')
--- a/data_generation/transformations/gimp_script.py	Tue Mar 16 12:01:31 2010 -0400
+++ b/data_generation/transformations/gimp_script.py	Tue Mar 16 12:14:10 2010 -0400
@@ -30,12 +30,16 @@
     return numpy.fromstring(dest_rgn[:,:], 'UInt8').astype(numpy.float32).reshape((32,32)).T / 255.0
 
 class GIMP1():
-    def get_settings_names(self):
+    def __init__(self, blur_bool = True):
+        #This is used to avoid blurring for PNIST
+        self.blur_bool = blur_bool
+
+    def get_settings_names(self, blur_bool = True):
         return ['mblur_length', 'mblur_angle', 'pinch']
     
     def regenerate_parameters(self, complexity):
-        if complexity:
-            self.mblur_length = abs(int(round(numpy.random.normal(0, 3*complexity))))
+        if complexity and self.blur_bool:
+           self.mblur_length = abs(int(round(numpy.random.normal(0, 3*complexity))))
         else:
             self.mblur_length = 0
         self.mblur_angle =  int(round(numpy.random.uniform(0,360)))