History

update bench-pitch update bench-pitch

Paul Brossier committed 20 years ago

Commit 807f0291 parent 66101431 file · +21 −9Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/test/bench/pitch/bench-pitch+21−9
@@ -9,15 +9,18 @@ class benchpitch(bench): · 8 unmodified lines
9 valuenames = ['mode']9 valuenames = ['mode']
10 """ list of lists to store per file """10 """ list of lists to store per file """
11 valuelists = ['truth', 'osil', 'esil', 'opit', 'epit', 'echr', 11 valuelists = ['truth', 'osil', 'esil', 'opit', 'epit', 'echr',
12 'Msil', 'Mpit', 'Mchr']12 'Msil', 'Mpit', 'Mchr',
13 'TotalPit', 'TotalPit', 'TotalChr' ]
13 """ list of values to print per dir """14 """ list of values to print per dir """
14 printnames = [ 'mode', 'truth', 'Msil', 'Mpit', 'Mchr']15 printnames = [ 'mode', 'MinPit', 'MaxPit', 'TotalSil', 'TotalPit', 'TotalChr']
15 16
16 """ per dir """17 """ per dir """
17 formats = {'mode': "%12s" , 18 formats = {'mode': "%12s" ,
18 'truth': "%s",19 'truth': "%s",
19 'osil': "%s", 'esil': "%s", 20 'osil': "%s", 'esil': "%s",
20 'opit': "%s", 'epit': "%s", 'echr': "%s",21 'opit': "%s", 'epit': "%s", 'echr': "%s",
22 'TotalPit': "%s", 'TotalSil': "%s", 'TotalChr': "%s",
23 'MinPit': "%s", 'MaxPit': "%s",
21 'Msil': "%s", 'Mpit': "%s", 'Mchr': "%s"}24 'Msil': "%s", 'Mpit': "%s", 'Mchr': "%s"}
22 25
23 def dir_eval(self):26 def dir_eval(self):
@@ -28,7 +31,7 @@ class benchpitch(bench): · 4 unmodified lines
28 def file_exec(self,input,output):31 def file_exec(self,input,output):
29 filetask = self.task(input,params=self.params)32 filetask = self.task(input,params=self.params)
30 computed_data = filetask.compute_all()33 computed_data = filetask.compute_all()
31 osil, esil, opit, epit, echr = filetask.eval(computed_data)34 osil, esil, opit, epit, echr = filetask.eval(computed_data,tol=0.5)
32 self.v['truth'].append(int(filetask.truth))35 self.v['truth'].append(int(filetask.truth))
33 assert opit > 036 assert opit > 0
34 37
@@ -51,7 +54,8 @@ class benchpitch(bench): · 16 unmodified lines
51 d = []54 d = []
52 for mode in self.modes:55 for mode in self.modes:
53 self.params.pitchmode = mode56 self.params.pitchmode = mode
54 self.dir_eval_print()57 self.dir_exec()
58 self.dir_eval()
55 truth = [i for i in range(min(self.v['truth']),max(self.v['truth'])+1)]59 truth = [i for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
56 allOsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]60 allOsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
57 allEsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]61 allEsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
@@ -68,9 +72,17 @@ class benchpitch(bench): · 10 unmodified lines
68 allEpit[self.v['truth'][i]-min(self.v['truth'])] += self.v['epit'][i]72 allEpit[self.v['truth'][i]-min(self.v['truth'])] += self.v['epit'][i]
69 allEchr[self.v['truth'][i]-min(self.v['truth'])] += self.v['echr'][i]73 allEchr[self.v['truth'][i]-min(self.v['truth'])] += self.v['echr'][i]
70 for i in range(len(truth)):74 for i in range(len(truth)):
75 allOsil[i] = max(1,allOsil[i])
76 allOpit[i] = max(1,allOpit[i])
71 allMsil[i] = allEsil[i]/float(allOsil[i])*100.77 allMsil[i] = allEsil[i]/float(allOsil[i])*100.
72 allMpit[i] = allEpit[i]/float(allOpit[i])*100.78 allMpit[i] = allEpit[i]/float(allOpit[i])*100.
73 allMchr[i] = allEchr[i]/float(allOpit[i])*100.79 allMchr[i] = allEchr[i]/float(allOpit[i])*100.
80 self.v['TotalSil'] = sum(allMsil)/len(truth)
81 self.v['TotalPit'] = sum(allMpit)/len(truth)
82 self.v['TotalChr'] = sum(allMchr)/len(truth)
83 self.v['MinPit'] = min(truth)
84 self.v['MaxPit'] = max(truth)
85 self.pretty_print()
74 86
75 plot = []87 plot = []
76 self.plotpitchtessiture(plot,88 self.plotpitchtessiture(plot,
@@ -155,16 +167,16 @@ if __name__ == "__main__": · 78 unmodified lines
155 else: print "error: a path is required"; sys.exit(1)167 else: print "error: a path is required"; sys.exit(1)
156 if len(sys.argv) > 2:168 if len(sys.argv) > 2:
157 for each in sys.argv[3:-1]: print each169 for each in sys.argv[3:-1]: print each
158 modes = ['schmitt', 'yin', 'mcomb', 'fcomb']170 modes = ['schmitt', 'yin', 'yinfft', 'mcomb', 'fcomb']
159 modes = ['schmitt', 'yin', 'fcomb']
160 171
161 params = taskparams()172 params = taskparams()
162 params.bufsize = 2048 173 params.bufsize = 2048 #4096
163 params.hopsize = params.bufsize/8174 params.hopsize = 256
164 params.silence = -60.175 params.silence = -70.
165 params.pitchsmooth = 0 176 params.pitchsmooth = 0
166 params.pitchmax = 20000177 params.pitchmax = 20000
167 params.pitchmin = 20178 params.pitchmin = 20
179 params.pitchyinfft = 0.95
168 benchpitch = benchpitch(datapath,params=params)180 benchpitch = benchpitch(datapath,params=params)
169 benchpitch.task = taskpitch181 benchpitch.task = taskpitch
170 182

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t