source: python/test/bench/onset/bench-onset @ 6ae3a77

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 6ae3a77 was 6ae3a77, checked in by Paul Brossier <piem@altern.org>, 19 years ago

update onset bench
update onset bench

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#! /usr/bin/python
2
3from aubio.tasks import *
4
5from benchonset import mmean, stdev, benchonset
6
7class mybenchonset(benchonset):
8
9        def run_bench(self,modes=['dual'],thresholds=[0.5]):
10                from os.path import dirname,basename
11                self.thresholds = thresholds
12                self.pretty_titles()
13                d,e,f,g = [],[],[],[]
14                for mode in modes:
15                        self.vlist = []
16                        self.params.onsetmode = mode
17                        #self.params.localmin = True
18                        self.params.delay = 2.
19                        self.params.bufsize = 1024
20                        self.params.hopsize = 256
21                        self.params.step = float(self.params.hopsize)/float(self.params.samplerate)
22                        #self.params.mintol = 8.
23
24                        for threshold in self.thresholds:
25                                self.params.threshold = threshold
26                                self.dir_eval_print()
27                                self.vlist.append(self.v)
28                        self.plotroc(d)
29                        self.plotfmeas(e)
30                        self.plotpr(f)
31                        #self.plothistcat(g)
32
33
34
35                #self.plotplotroc(d)
36                #self.plotplotfmeas(e)
37                #self.plotplotpr(f)
38                outplot = basename(self.datadir)
39                for ext in ("png","svg","ps"):
40                        self.plotplotroc(d,outplot=outplot,extension=ext)
41                        self.plotplotfmeas(e,outplot=outplot,extension=ext)
42                        self.plotplotpr(f,outplot=outplot,extension=ext)
43                        #self.plotplothistcat(g,outplot=outplot,extension=ext)
44
45if __name__ == "__main__":
46        import sys
47        if len(sys.argv) > 1: datapath = sys.argv[1]
48        else: print "ERR: a path is required"; sys.exit(1)
49        modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
50        thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
51        #modes = [ 'hfc' ]
52        #thresholds = [0.5]
53
54        #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
55        respath = '/var/tmp/DB-testings'
56
57        benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
58        benchonset.params = taskparams()
59        benchonset.task = taskonset
60        benchonset.valuesdict = {}
61
62        try:
63                #benchonset.auto_learn2(modes=modes)
64                benchonset.run_bench(modes=modes,thresholds=thresholds)
65        except KeyboardInterrupt:
66                sys.exit(1)
Note: See TracBrowser for help on using the repository browser.