denote.benchmark¶
Score chord recognition against a labelled set with mir_eval, the same way for any backend.
A labelled set is an iterable of (audio, reference) pairs (or ChordItem); a reference is
(intervals, labels) or [{start, end, label}], labels in Harte syntax. Scores are
mir_eval.chord weighted chord symbol recall (root, majmin, sevenths, …) plus
segmentation quality, per item and pooled (duration-weighted over the whole set).
>>> from denote.benchmark import ChordItem, evaluate_chords
>>> report = evaluate_chords(items)
>>> report["pooled"]["majmin"]
0.71
guitarset_items(root) yields GuitarSet’s microphone comping takes (needs jams);
load_jams_chords reads any JAMS chord annotation. mir_eval is imported lazily and comes
with the eval extra.
Module Attributes
mir_eval.chord comparison functions scored by default, loosest to strictest |
Functions
|
Run a chord recogniser over a labelled set and score it. |
|
GuitarSet microphone comping takes as ``ChordItem``s. |
|
|
|
Score one estimate against one reference. |
Classes
|
One labelled recording: audio (path or array + |
- class denote.benchmark.ChordItem(audio, reference, name='', sr=None, kwargs=dict())[source]¶
Bases:
objectOne labelled recording: audio (path or array +
sr) and its reference chords.
- denote.benchmark.DFLT_METRICS = ('root', 'majmin', 'sevenths')¶
mir_eval.chord comparison functions scored by default, loosest to strictest
- denote.benchmark.evaluate_chords(items, *, backend=None, recognizer=None, metrics=('root', 'majmin', 'sevenths'), **backend_kwargs)[source]¶
Run a chord recogniser over a labelled set and score it.
- Parameters:
items (
Iterable) –(audio, reference)pairs orChordItem.backend (
Optional[str]) – A chords backend name (default: the registry’s default for chords).recognizer (
Optional[Callable]) – Instead of a backend, anyf(audio, **kwargs) -> ChordResult.**backend_kwargs – passed to every call (e.g.
vocabulary=,causal=True).
- Returns:
{name: {metric: ratio, …, “segmentation”: …}}, “pooled”: {metric: ratio}, “n_items”: n, “backend”: name}``. Pooled ratios weight each item by its duration.
- Return type:
- denote.benchmark.guitarset_items(root, *, players=None, annotation='performed')[source]¶
GuitarSet microphone comping takes as ``ChordItem``s.
rootholdsaudio_mono-mic/*_comp_mic.wavandann/*.jams(the dataset’s layout, CC BY 4.0).playersrestricts to those player numbers 0-5;annotationis"performed"(what was played) or"instructed"(the lead sheet).
- denote.benchmark.load_jams_chords(path, *, index=0, namespace='chord')[source]¶
(intervals, labels)of theindex-th chord annotation of a JAMS file (needsjams).
- denote.benchmark.score_chords(reference, estimate, *, duration=None, metrics=('root', 'majmin', 'sevenths'))[source]¶
Score one estimate against one reference. Both are
(intervals, labels)or segment lists.Returns
{metric: (credit_seconds, total_seconds), ..., "segmentation": {...}}: seconds, not ratios, so a set can be pooled by summing. Time outside either annotation counts asN.- Return type: