History

updated aubiocompare-onset and onsetcompare.py

Paul Brossier committed 21 years ago

Commit 7445aea1 parent 20f97482 files · +12 −3Browse files

Showing the changes to python (2 of 2 files). Show all

Unified · Split

2 files
  1. python/aubio/onsetcompare.py +6 −0
  2. python/aubiocompare-onset +6 −3
python/aubio/onsetcompare.py+6−0
@@ -53,6 +53,12 @@ def onset_roc(la, lb, eps): · 52 unmodified lines
5353 bad += 1
5454 ok = n - missed
5555 hits = m - bad
56+ # at this point, we must have ok = hits. if not we had
57+ # - a case were one onset counted for two labels (ok>hits)
58+ # - a case were one labels matched two onsets (hits>ok)
59+ # bad hack for now (fails if both above cases have happened):
60+ if ok > hits: bad += ok-hits; ok = hits
61+ if hits > ok: missed += hits-ok; hits = ok
5662 total = n
5763 return ok,bad,missed,total,hits
5864
python/aubiocompare-onset+6−3
@@ -60,7 +60,8 @@ from aubio.txtfile import read_datafile · 59 unmodified lines
6060 # default values
6161 fileo=None;filec=None;vmode=None;dmode=None;delay=0.
6262 # default tolerance is 50 ms
63−tol = 0.050
63+#tol = 0.050
64+tol = 0.048
6465
6566 while len(sys.argv) >=2:
6667 option = sys.argv[1]; del sys.argv[1]
@@ -70,6 +71,7 @@ while len(sys.argv) >=2: · 3 unmodified lines
7071 if option == '-v': vmode = 'verbose'
7172 if option == '-d': dmode = 'debug'
7273 if option == '-D': delay = float(sys.argv[1]); del sys.argv[1]
74+ if option == '-tol': tol = float(sys.argv[1]); del sys.argv[1]
7375
7476 # arguments required
7577 if (not fileo) or (not filec):
@@ -80,8 +82,9 @@ if (not fileo) or (not filec): · 4 unmodified lines
8082 ltru, lres = read_datafile(fileo,depth=0),read_datafile(filec,depth=0)
8183
8284 # delay onsets as required with -D
83−for i in range(len(lres)):
84− lres[i] = lres[i] + delay
85+if delay:
86+ for i in range(len(lres)):
87+ lres[i] = lres[i] + delay
8588 # compute errors types
8689 ok, bad, missed, total, hits = onset_roc(ltru,lres,tol)
8790

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