diff data_generation/transformations/gimp_script.py @ 244:39421555993f

small change in gimp_script to avoid blurring in PNIST
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Tue, 16 Mar 2010 12:12:20 -0400
parents 1f5937e9e530
children dd2df78fcf47
line wrap: on
line diff
--- a/data_generation/transformations/gimp_script.py	Tue Mar 02 14:47:18 2010 -0500
+++ b/data_generation/transformations/gimp_script.py	Tue Mar 16 12:12:20 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)))