annotate transformations/testtransformations.py @ 115:b84a0d009af8

changes on pipeline mecanism: we now sample a different complexity for each transformations, this because when we use the same sampled complexity for all the modules 1/8 of the time we are close to 0 and we obtain an image very close to the source, we now save a complexity for each module in the parameters array
author Xavier Glorot <glorotxa@iro.umontreal.ca>
date Wed, 17 Feb 2010 16:20:15 -0500
parents 291d749452df
children 0d083964af4b
rev   line source
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
1 #!/usr/bin/env python
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
2
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
3
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
4
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
5 from pylearn.io import filetensor as ft
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
6 import copy
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
7 import pygame
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
8 import time
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
9 import numpy as N
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
10
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
11 from ttf2jpg import ttf2jpg
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
12
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
13 #from gimpfu import *
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
14
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
15
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
16 from PoivreSel import PoivreSel
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
17 from thick import Thick
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
18 from BruitGauss import BruitGauss
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
19 from DistorsionGauss import DistorsionGauss
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
20 from PermutPixel import PermutPixel
84
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
21 from gimp_script import GIMP1
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
22 from Rature import Rature
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
23 from contrast import Contrast
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
24 from local_elastic_distortions import LocalElasticDistorter
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
25 from slant import Slant
80
4407ab3f7805 small display change in testtransformation
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 57
diff changeset
26 from Occlusion import Occlusion
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
27 from add_background_image import AddBackground
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
28 from affine_transform import AffineTransformation
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
29
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
30 ###---------------------order of transformation module
97
b3d15100842a Changed order of transformation
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 94
diff changeset
31 MODULE_INSTANCES = [Slant(),Thick(),AffineTransformation(),LocalElasticDistorter(),GIMP1(),Rature(),Occlusion(), PermutPixel(),DistorsionGauss(),AddBackground(), PoivreSel(), BruitGauss(), Contrast()]
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
32
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
33 ###---------------------complexity associated to each of them
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
34 complexity = [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
35 #complexity = [0.5]*len(MODULE_INSTANCES)
84
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
36 #complexity = [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]
80
4407ab3f7805 small display change in testtransformation
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 57
diff changeset
37
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
38 def createimage(path,d):
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
39 for i in range(100):
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
40 screen.fill(0)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
41 a=d[i,:]
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
42 off1=4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
43 off2=0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
44 for u in range(100):
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
45 b=N.asarray(N.reshape(a,(32,32)))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
46 c=N.asarray([N.reshape(a*255.0,(32,32))]*3).T
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
47 new=pygame.surfarray.make_surface(c)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
48 new=pygame.transform.scale2x(new)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
49 new=pygame.transform.scale2x(new)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
50 #new.set_palette(anglcolorpalette)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
51 screen.blit(new,(0,0))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
52 exemple.blit(new,(0,0))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
53
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
54 offset = 4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
55 offset2 = 0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
56 ct = 0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
57 for j in MODULE_INSTANCES:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
58 #max dilation
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
59 ctmp = N.random.rand()*complexity[ct]
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
60 #random
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
61 print j.get_settings_names(), j.regenerate_parameters(ctmp)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
62
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
63 b=j.transform_image(b)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
64 c=N.asarray([b*255]*3).T
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
65 new=pygame.surfarray.make_surface(c)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
66 new=pygame.transform.scale2x(new)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
67 new=pygame.transform.scale2x(new)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
68 if u==0:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
69 #new.set_palette(anglcolorpalette)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
70 screen.blit(new,(offset,offset2))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
71 font = pygame.font.SysFont('liberationserif',18)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
72 text = font.render('%s '%(int(ctmp*100.0)/100.0) + j.__module__,0,(255,255,255),(0,0,0))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
73 screen.blit(text,(offset,offset2+4*32))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
74 if ct == len(MODULE_INSTANCES)/2-1:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
75 offset = 0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
76 offset2 = 4*32+20
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
77 else:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
78 offset += 4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
79 ct+=1
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
80 exemple.blit(new,(off1,off2))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
81 if off1 != 9*4*32:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
82 off1+=4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
83 else:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
84 off1=0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
85 off2+=4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
86 pygame.image.save(exemple,path+'/perimages/%s.PNG'%i)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
87 pygame.image.save(screen,path+'/exemples/%s.PNG'%i)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
88
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
89
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
90
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
91
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
92 nbmodule = len(MODULE_INSTANCES)
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
93
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
94 pygame.surfarray.use_arraytype('numpy')
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
95
84
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
96 #pygame.display.init()
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
97 screen = pygame.Surface((4*(nbmodule+1)/2*32,2*(4*32+20)),depth=32)
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
98 exemple = pygame.Surface((10*4*32,10*4*32),depth=32)
84
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
99
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
100 anglcolorpalette=[(x,x,x) for x in xrange(0,256)]
84
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
101 #pygame.Surface.set_palette(anglcolorpalette)
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
102 #screen.set_palette(anglcolorpalette)
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
103
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
104 pygame.font.init()
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
105
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
106 d = N.zeros((100,1024))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
107
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
108 from Facade import *
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
109
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
110 for i in range(100):
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
111 d[i,:]=N.asarray(N.reshape(generateCaptcha(0,0),(1,1024))/255.0,dtype='float32')
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
112
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
113 createimage('/u/glorotxa/transf/capcha',d)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
114
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
115
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
116 for i in range(100):
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
117 myttf2jpg = ttf2jpg()
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
118 d[i,:]=N.reshape(myttf2jpg.generate_image(),(1,1024))
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
119 createimage('/u/glorotxa/transf/fonts',d)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
120
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
121
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
122
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
123 datapath = '/data/lisa/data/nist/by_class/'
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
124 f = open(datapath+'lower/lower_train_data.ft')
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
125 d = ft.read(f)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
126 d = d[0:100,:]/255.0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
127 createimage('/u/glorotxa/transf/NIST_lower',d)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
128
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
129 datapath = '/data/lisa/data/nist/by_class/'
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
130 f = open(datapath+'upper/upper_train_data.ft')
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
131 d = ft.read(f)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
132 d = d[0:100,:]/255.0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
133 createimage('/u/glorotxa/transf/NIST_upper',d)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
134
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
135 datapath = '/data/lisa/data/nist/by_class/'
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
136 f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft')
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
137 d = ft.read(f)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
138 d = d[0:100,:]/255.0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
139 createimage('/u/glorotxa/transf/NIST_digits',d)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
140
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
141 datapath = '/data/lisa/data/ocr_breuel/filetensor/unlv-corrected-2010-02-01-shuffled.ft/'
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
142 f = open(datapath)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
143 d = ft.read(f)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
144 d = d[0:100,:]/255.0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
145 createimage('/u/glorotxa/transf/OCR',d)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
146
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
147
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
148
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
149
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
150
84
104e0b8a1c70 testtransformation now work with all the transformations and save image files (.PNG) to a hard coded path
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 80
diff changeset
151 #pygame.display.quit()