madmom.evaluation.tempo¶
This module contains tempo evaluation functionality.
-
madmom.evaluation.tempo.
sort_tempo
(tempo)[source]¶ Sort tempi according to their strengths.
Parameters: - tempo : numpy array, shape (num_tempi, 2)
Tempi (first column) and their relative strength (second column).
Returns: - tempi : numpy array, shape (num_tempi, 2)
Tempi sorted according to their strength.
-
madmom.evaluation.tempo.
tempo_evaluation
(detections, annotations, tolerance=0.04)[source]¶ Calculate the tempo P-Score, at least one and all tempi correct.
Parameters: - detections : list of tuples or numpy array
Detected tempi (rows, first column) and their relative strengths (second column).
- annotations : list or numpy array
Annotated tempi (rows, first column) and their relative strengths (second column).
- tolerance : float, optional
Evaluation tolerance (max. allowed deviation).
Returns: - pscore : float
P-Score.
- at_least_one : bool
At least one tempo correctly identified.
- all : bool
All tempi correctly identified.
Notes
All given detections are evaluated against all annotations according to the relative strengths given. If no strengths are given, evenly distributed strengths are assumed. If the strengths do not sum to 1, they will be normalized.
References
[1] M. McKinney, D. Moelants, M. Davies and A. Klapuri, “Evaluation of audio beat tracking and music tempo extraction algorithms”, Journal of New Music Research, vol. 36, no. 1, 2007.
-
class
madmom.evaluation.tempo.
TempoEvaluation
(detections, annotations, tolerance=0.04, double=True, triple=True, sort=True, max_len=None, name=None, **kwargs)[source]¶ Tempo evaluation class.
Parameters: - detections : str, list of tuples or numpy array
Detected tempi (rows) and their strengths (columns). If a file name is given, load them from this file.
- annotations : str, list or numpy array
Annotated ground truth tempi (rows) and their strengths (columns). If a file name is given, load them from this file.
- tolerance : float, optional
Evaluation tolerance (max. allowed deviation).
- double : bool, optional
Include double and half tempo variations.
- triple : bool, optional
Include triple and third tempo variations.
- sort : bool, optional
Sort the tempi by their strengths (descending order).
- max_len : bool, optional
Evaluate at most max_len tempi.
- name : str, optional
Name of the evaluation to be displayed.
Notes
For P-Score, the number of detected tempi will be limited to the number of annotations (if not further limited by max_len). For Accuracy 1 & 2 only one detected tempo is used. Depending on sort, this can be either the first or the strongest one.
-
class
madmom.evaluation.tempo.
TempoMeanEvaluation
(eval_objects, name=None, **kwargs)[source]¶ Class for averaging tempo evaluation scores.
-
pscore
¶ P-Score.
-
any
¶ At least one tempo correct.
-
all
¶ All tempi correct.
-
acc1
¶ Accuracy 1.
-
acc2
¶ Accuracy 2.
-
-
madmom.evaluation.tempo.
add_parser
(parser)[source]¶ Add a tempo evaluation sub-parser to an existing parser.
Parameters: - parser : argparse parser instance
Existing argparse parser object.
Returns: - sub_parser : argparse sub-parser instance
Tempo evaluation sub-parser.
- parser_group : argparse argument group
Tempo evaluation argument group.