ref: 7445aea4eaa48f1083b613251ed50992cc3f5525
parent: 20f9748f8001e6023bc58e2593c227a066ff103e
author: Paul Brossier <piem@altern.org>
date: Tue Mar 29 10:46:05 EST 2005
updated aubiocompare-onset and onsetcompare.py
--- a/python/aubio/onsetcompare.py
+++ b/python/aubio/onsetcompare.py
@@ -53,6 +53,12 @@
bad += 1
ok = n - missed
hits = m - bad
+ # at this point, we must have ok = hits. if not we had
+ # - a case were one onset counted for two labels (ok>hits)
+ # - a case were one labels matched two onsets (hits>ok)
+ # bad hack for now (fails if both above cases have happened):
+ if ok > hits: bad += ok-hits; ok = hits
+ if hits > ok: missed += hits-ok; hits = ok
total = n
return ok,bad,missed,total,hits
--- a/python/aubiocompare-onset
+++ b/python/aubiocompare-onset
@@ -60,7 +60,8 @@
# default values
fileo=None;filec=None;vmode=None;dmode=None;delay=0.
# default tolerance is 50 ms
-tol = 0.050
+#tol = 0.050
+tol = 0.048
while len(sys.argv) >=2:
option = sys.argv[1]; del sys.argv[1]
@@ -70,6 +71,7 @@
if option == '-v': vmode = 'verbose'
if option == '-d': dmode = 'debug'
if option == '-D': delay = float(sys.argv[1]); del sys.argv[1]
+ if option == '-tol': tol = float(sys.argv[1]); del sys.argv[1]
# arguments required
if (not fileo) or (not filec):
@@ -80,8 +82,9 @@
ltru, lres = read_datafile(fileo,depth=0),read_datafile(filec,depth=0)
# delay onsets as required with -D
-for i in range(len(lres)):
- lres[i] = lres[i] + delay
+if delay:
+ for i in range(len(lres)):
+ lres[i] = lres[i] + delay
# compute errors types
ok, bad, missed, total, hits = onset_roc(ltru,lres,tol)