annotate transformations/testtransformations.py @ 122:5d22498c73d1

Correction d'un petit bug (random.randint a des bornes inclusives, ce qui pouvait creer un petit bug)
author SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca>
date Thu, 18 Feb 2010 10:55:29 -0500
parents 5e00ed18ae32
children a507adba0ce3
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
120
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
34 complexity = 0.7
113
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.]
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
37 n=100
80
4407ab3f7805 small display change in testtransformation
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 57
diff changeset
38
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
39 def createimage(path,d):
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
40 for i in range(n):
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
41 screen.fill(0)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
42 a=d[i,:]
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
43 off1=4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
44 off2=0
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
45 for u in range(n):
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
46 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
47 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
48 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
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=pygame.transform.scale2x(new)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
51 #new.set_palette(anglcolorpalette)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
52 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
53 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
54
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
55 offset = 4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
56 offset2 = 0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
57 ct = 0
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
58 ctmp = N.random.rand()*complexity
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
59 print u
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
60 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
61 #max dilation
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
62 #ctmp = N.random.rand()*complexity[ct]
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
63 ctmp = N.random.rand()*complexity
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
64 #print j.get_settings_names(), j.regenerate_parameters(ctmp)
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
65 j.regenerate_parameters(ctmp)
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
66
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
67 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
68 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
69 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
70 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
71 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
72 if u==0:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
73 #new.set_palette(anglcolorpalette)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
74 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
75 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
76 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
77 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
78 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
79 offset = 0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
80 offset2 = 4*32+20
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
81 else:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
82 offset += 4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
83 ct+=1
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
84 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
85 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
86 off1+=4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
87 else:
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
88 off1=0
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
89 off2+=4*32
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
90 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
91 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
92
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
93
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
94
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
95
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
96 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
97
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
98 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
99
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
100 #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
101 screen = pygame.Surface((4*(nbmodule+1)/2*32,2*(4*32+20)),depth=32)
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
102 exemple = pygame.Surface((N.ceil(N.sqrt(n))*4*32,N.ceil(N.sqrt(n))*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
103
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
104 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
105 #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
106 #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
107
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
108 pygame.font.init()
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
109
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
110 d = N.zeros((n,1024))
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
111
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
112 from Facade import *
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
113
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
114 for i in range(n):
120
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
115 d[i,:]=N.asarray(N.reshape(generateCaptcha(0.8,0),(1,1024))/255.0,dtype='float32')
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
116
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
117 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
118
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
119
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
120 for i in range(n):
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
121 myttf2jpg = ttf2jpg()
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
122 d[i,:]=N.reshape(myttf2jpg.generate_image()[0],(1,1024))
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
123 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
124
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
125
120
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
126 datapath = '/data/lisa/data/nist/by_class/'
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
127 f = open(datapath+'digits_reshuffled/digits_reshuffled_train_data.ft')
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
128 d = ft.read(f)
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
129 d = d[0:n,:]/255.0
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
130 createimage('/u/glorotxa/transf/NIST_digits',d)
5e00ed18ae32 changed some transformation paramters to better fit with visualization
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 118
diff changeset
131
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
132
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
133 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
134 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
135 d = ft.read(f)
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
136 d = d[0:n,:]/255.0
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
137 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
138
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
139 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
140 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
141 d = ft.read(f)
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
142 d = d[0:n,:]/255.0
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
143 createimage('/u/glorotxa/transf/NIST_upper',d)
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
144 datapath = '/data/lisa/data/ocr_breuel/filetensor/unlv-corrected-2010-02-01-shuffled.ft'
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
145 f = open(datapath)
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
146 d = ft.read(f)
118
0d083964af4b small change to testtransformation to match with the pipeline behavior
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 113
diff changeset
147 d = d[0:n,:]/255.0
113
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
148 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
149
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
150
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
151
291d749452df testtransformation.py to source from all the available data
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 97
diff changeset
152
57
6846136b2201 Add a simple test script to see transformation step by step
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents:
diff changeset
153
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
154 #pygame.display.quit()