source: tests/demo/bench/onset/bench-onset @ 974dddc

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

move tests/python/demo to tests/, add localaubio.py module helpers

  • Property mode set to 100755
File size: 2.0 KB
Line 
1#! /usr/bin/python
2
3from aubio.task import *
4
5from aubio.bench.onset 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
19                        for threshold in self.thresholds:
20                                self.params.threshold = threshold
21                                self.dir_eval_print()
22                                self.vlist.append(self.v)
23                        self.plotroc(d)
24                        self.plotfmeas(e)
25                        self.plotpr(f)
26                        #self.plothistcat(g)
27
28
29
30                #self.plotplotroc(d)
31                #self.plotplotfmeas(e)
32                #self.plotplotpr(f)
33                outplot = basename(self.datadir)
34                for ext in ("png","svg","ps"):
35                        self.plotplotroc(d,outplot=outplot,extension=ext)
36                        self.plotplotfmeas(e,outplot=outplot,extension=ext)
37                        self.plotplotpr(f,outplot=outplot,extension=ext)
38                        #self.plotplothistcat(g,outplot=outplot,extension=ext)
39
40if __name__ == "__main__":
41        import sys
42        if len(sys.argv) > 1: datapath = sys.argv[1]
43        else: print "ERR: a path is required"; sys.exit(1)
44        modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
45        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]
46        #modes = [ 'hfc' ]
47        #thresholds = [0.5]
48
49        #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
50        respath = '/var/tmp/DB-testings'
51
52        benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
53        benchonset.params = taskparams()
54        benchonset.params.dcthreshold = -1.
55        benchonset.params.silence = -100.
56        benchonset.params.delay = 5.
57        benchonset.params.bufsize = 1024
58        benchonset.params.hopsize = 256
59        benchonset.params.step = float(benchonset.params.hopsize)/float(benchonset.params.samplerate)
60        benchonset.params.mintol = 4.1
61        benchonset.task = taskonset
62        benchonset.valuesdict = {}
63
64        try:
65                #benchonset.auto_learn2(modes=modes)
66                benchonset.run_bench(modes=modes,thresholds=thresholds)
67        except KeyboardInterrupt:
68                sys.exit(1)
Note: See TracBrowser for help on using the repository browser.