changeset 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 4f37755d301b
children 4a29910eae93
files transformations/PoivreSel.py transformations/affine_transform.py transformations/testtransformations.py transformations/thick.py
diffstat 4 files changed, 22 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/transformations/PoivreSel.py	Wed Feb 17 17:06:54 2010 -0500
+++ b/transformations/PoivreSel.py	Wed Feb 17 17:45:48 2010 -0500
@@ -23,7 +23,7 @@
 class PoivreSel():
     
     def __init__(self):
-        self.proportion_bruit=0.1 #Le pourcentage des pixels qui seront bruites
+        self.proportion_bruit=0.08 #Le pourcentage des pixels qui seront bruites
         self.nb_chng=10 #Le nombre de pixels changes. Seulement pour fin de calcul
         self.effectuer=1    #Vaut 1 si on effectue et 0 sinon.
         
--- a/transformations/affine_transform.py	Wed Feb 17 17:06:54 2010 -0500
+++ b/transformations/affine_transform.py	Wed Feb 17 17:45:48 2010 -0500
@@ -19,12 +19,12 @@
         self.rng = numpy.random.RandomState()
         self.complexity = complexity
         params = self.rng.uniform(size=6) -.5
-        self.a = 1. + params[0]*.4*complexity
-        self.b = 0. + params[1]*.4*complexity
-        self.c = params[2]*8.*complexity
-        self.d = 0. + params[3]*.4*complexity
-        self.e = 1. + params[4]*.4*complexity
-        self.f = params[5]*8.*complexity
+        self.a = 1. + params[0]*.8*complexity
+        self.b = 0. + params[1]*.8*complexity
+        self.c = params[2]*9.*complexity
+        self.d = 0. + params[3]*.8*complexity
+        self.e = 1. + params[4]*.8*complexity
+        self.f = params[5]*9.*complexity
 
     
     def _get_current_parameters(self):
@@ -44,12 +44,12 @@
  
         self.complexity = complexity
         params = self.rng.uniform(size=6) -.5
-        self.a = 1. + params[0]*.4*complexity
-        self.b = 0. + params[1]*.4*complexity
-        self.c = params[2]*8.*complexity
-        self.d = 0. + params[3]*.4*complexity
-        self.e = 1. + params[4]*.4*complexity
-        self.f = params[5]*8.*complexity
+        self.a = 1. + params[0]*.8*complexity
+        self.b = 0. + params[1]*.8*complexity
+        self.c = params[2]*9.*complexity
+        self.d = 0. + params[3]*.8*complexity
+        self.e = 1. + params[4]*.8*complexity
+        self.f = params[5]*9.*complexity
         return self._get_current_parameters()
 
       
--- a/transformations/testtransformations.py	Wed Feb 17 17:06:54 2010 -0500
+++ b/transformations/testtransformations.py	Wed Feb 17 17:45:48 2010 -0500
@@ -31,7 +31,7 @@
 MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(),Rature(),Occlusion(), PermutPixel(),DistorsionGauss(),AddBackground(), PoivreSel(), BruitGauss(), Contrast()]
 
 ###---------------------complexity associated to each of them
-complexity = 0.6
+complexity = 0.7
 #complexity = [0.5]*len(MODULE_INSTANCES)
 #complexity = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
 n=100
@@ -109,17 +109,10 @@
 
 d = N.zeros((n,1024))
 
-
-datapath = '/data/lisa/data/nist/by_class/'
-f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft')
-d = ft.read(f)
-d = d[0:n,:]/255.0
-createimage('/u/glorotxa/transf/NIST_digits',d)
-
 from Facade import *
 
 for i in range(n):
-    d[i,:]=N.asarray(N.reshape(generateCaptcha(0.5,0),(1,1024))/255.0,dtype='float32')
+    d[i,:]=N.asarray(N.reshape(generateCaptcha(0.8,0),(1,1024))/255.0,dtype='float32')
 
 createimage('/u/glorotxa/transf/capcha',d)
 
@@ -130,6 +123,12 @@
 createimage('/u/glorotxa/transf/fonts',d)
 
 
+datapath = '/data/lisa/data/nist/by_class/'
+f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft')
+d = ft.read(f)
+d = d[0:n,:]/255.0
+createimage('/u/glorotxa/transf/NIST_digits',d)
+
 
 datapath = '/data/lisa/data/nist/by_class/'
 f = open(datapath+'lower/lower_train_data.ft')
--- a/transformations/thick.py	Wed Feb 17 17:06:54 2010 -0500
+++ b/transformations/thick.py	Wed Feb 17 17:45:48 2010 -0500
@@ -21,7 +21,7 @@
         #---------- private attributes
         self.__nx__ = 32 #xdim of the images
         self.__ny__ = 32 #ydim of the images
-        self.__erodemax__ = 9 #nb of index max of erode structuring elements
+        self.__erodemax__ = 5 #nb of index max of erode structuring elements
         self.__dilatemax__ = 9 #nb of index max of dilation structuring elements
         self.__structuring_elements__ = [N.asarray([[1,1]]),N.asarray([[1],[1]]),\
                                         N.asarray([[1,1],[1,1]]),N.asarray([[0,1,0],[1,1,1],[0,1,0]]),\