Mercurial > ift6266
comparison 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 |
comparison
equal
deleted
inserted
replaced
191:3632e6258642 | 244:39421555993f |
---|---|
28 | 28 |
29 def getpix(): | 29 def getpix(): |
30 return numpy.fromstring(dest_rgn[:,:], 'UInt8').astype(numpy.float32).reshape((32,32)).T / 255.0 | 30 return numpy.fromstring(dest_rgn[:,:], 'UInt8').astype(numpy.float32).reshape((32,32)).T / 255.0 |
31 | 31 |
32 class GIMP1(): | 32 class GIMP1(): |
33 def get_settings_names(self): | 33 def __init__(self, blur_bool = True): |
34 #This is used to avoid blurring for PNIST | |
35 self.blur_bool = blur_bool | |
36 | |
37 def get_settings_names(self, blur_bool = True): | |
34 return ['mblur_length', 'mblur_angle', 'pinch'] | 38 return ['mblur_length', 'mblur_angle', 'pinch'] |
35 | 39 |
36 def regenerate_parameters(self, complexity): | 40 def regenerate_parameters(self, complexity): |
37 if complexity: | 41 if complexity and self.blur_bool: |
38 self.mblur_length = abs(int(round(numpy.random.normal(0, 3*complexity)))) | 42 self.mblur_length = abs(int(round(numpy.random.normal(0, 3*complexity)))) |
39 else: | 43 else: |
40 self.mblur_length = 0 | 44 self.mblur_length = 0 |
41 self.mblur_angle = int(round(numpy.random.uniform(0,360))) | 45 self.mblur_angle = int(round(numpy.random.uniform(0,360))) |
42 self.pinch = numpy.random.uniform(-complexity, 0.7*complexity) | 46 self.pinch = numpy.random.uniform(-complexity, 0.7*complexity) |
43 | 47 |