question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow evaluation for beat tracking

See original GitHub issue

It seems that the beat evaluation integrated in jams is quite slow compared to more standard techniques. When I use the file example_eval.py from the jams example documentation the computational time is 10 times longer than when I use even a simple baseline. The result is of course identical.

example_eval.py:

#!/usr/bin/env python

import sys
import jams

from pprint import pprint

def compare_beats(f_ref, f_est):

    # f_ref contains the reference annotations
    j_ref = jams.load(f_ref, validate=False)

    # f_est contains the estimated annotations
    j_est = jams.load(f_est, validate=False)

    # Get the first reference beats
    beat_ref = j_ref.search(namespace='beat')[0]
    beat_est = j_est.search(namespace='beat')[0]

    # Get the scores
    return jams.eval.beat(beat_ref, beat_est)


if __name__ == '__main__':

    f_ref, f_est = sys.argv[1:]
    scores = compare_beats(f_ref, f_est)

    # Print them out
    pprint(dict(scores))

I used validate=False as without it, the process is slower. The code is then: example_eval.compare_beats(infile_1, infile_2) Where infile_1 and infile_2 are 2 jams files.

Simple baseline:

import numpy as np
import mir_eval

thefile = open(infile_1, 'r')
lines = thefile.readlines()
beats_pos_1 = np.zeros(0)
for line in lines:
    if line[:18] == '          "time": ':
        beats_pos_1 = np.append(beats_pos_1, line[18:-1])
thefile.close()
beats_pos_1 = beats_pos_1.astype('float')

thefile = open(infile_2, 'r')
lines = thefile.readlines()
beats_pos_2 = np.zeros(0)
for line in lines:
    if line[:18] == '          "time": ':
        beats_pos_2 = np.append(beats_pos_2, line[18:-1])
thefile.close()
beats_pos_2 = beats_pos_2.astype('float')
mir_eval.beat.evaluate(beats_pos_1, beats_pos_2)

I used the same jams files in both cases for comparison purposes. But in the second case, I could use a more efficient format that would make the evaluation faster.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
simondurandcommented, Oct 19, 2017

It is faster now. Thanks for the push.

0reactions
bmcfeecommented, Oct 19, 2017

Thanks for checking. I’ll close this one out then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Evaluation Methods for Musical Audio Beat Tracking Algorithms
In this paper we address the under-explored topic of beat tracking evaluation. We present a review of existing evaluation models and, ...
Read more >
EVALUATING THE EVALUATION MEASURES FOR BEAT ...
The evaluation of audio beat tracking systems is normally addressed in one of two ways. One approach is for human listeners to judge...
Read more >
How do we evaluate? — Tempo, Beat and Downbeat Estimation
However, the design and execution of large scale evaluation of beat (or downbeat) tracking algorithms where rating scales are used to grade performance...
Read more >
Evaluation of the Audio Beat Tracking System BeatRoot
Abstract. BeatRoot is an interactive beat tracking and metrical annotation system which has been used for several years in studies of performance timing....
Read more >
[PDF] Evaluating the Evaluation Measures for Beat Tracking
The evaluation of audio beat tracking systems is normally addressed in one of two ways. ... with the musical properties of expressive timing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found