source: python.old/tests_demo_bench/onset/bench-onset @ 4dd7816

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

moved old python stuff out of tests/

  • Property mode set to 100755
File size: 2.0 KB
RevLine 
[4cc9fe5]1#! /usr/bin/python
2
[43938de]3from aubio.task import *
[75139a9]4
[43938de]5from aubio.bench.onset import mmean, stdev, benchonset
[e968939]6
[83c6734]7class mybenchonset(benchonset):
[75139a9]8
9        def run_bench(self,modes=['dual'],thresholds=[0.5]):
[83c6734]10                from os.path import dirname,basename
[75139a9]11                self.thresholds = thresholds
[e968939]12                self.pretty_titles()
[6ae3a77]13                d,e,f,g = [],[],[],[]
[83c6734]14                for mode in modes:
15                        self.vlist = []
[4f4a8a4]16                        self.params.onsetmode = mode
[6ae3a77]17                        #self.params.localmin = True
18
[75139a9]19                        for threshold in self.thresholds:
20                                self.params.threshold = threshold
[6ae3a77]21                                self.dir_eval_print()
[83c6734]22                                self.vlist.append(self.v)
23                        self.plotroc(d)
24                        self.plotfmeas(e)
25                        self.plotpr(f)
[6ae3a77]26                        #self.plothistcat(g)
27
28
29
[83c6734]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)
[6ae3a77]38                        #self.plotplothistcat(g,outplot=outplot,extension=ext)
[75139a9]39
[4f4a8a4]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)
[83c6734]44        modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
[e968939]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]
[83c6734]46        #modes = [ 'hfc' ]
[6ae3a77]47        #thresholds = [0.5]
[4f4a8a4]48
49        #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
50        respath = '/var/tmp/DB-testings'
51
[83c6734]52        benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
[4f4a8a4]53        benchonset.params = taskparams()
[cafb00a]54        benchonset.params.dcthreshold = -1.
55        benchonset.params.silence = -100.
[2e2bfff]56        benchonset.params.delay = 5.
[cafb00a]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
[4f4a8a4]61        benchonset.task = taskonset
[e968939]62        benchonset.valuesdict = {}
[4f4a8a4]63
64        try:
[e968939]65                #benchonset.auto_learn2(modes=modes)
66                benchonset.run_bench(modes=modes,thresholds=thresholds)
[4f4a8a4]67        except KeyboardInterrupt:
68                sys.exit(1)
Note: See TracBrowser for help on using the repository browser.