Skip to content

Instantly share code, notes, and snippets.

@hbredin
Last active March 28, 2019 09:56
Show Gist options
  • Save hbredin/a6da359ced429c00a001820a9a4b5050 to your computer and use it in GitHub Desktop.
Save hbredin/a6da359ced429c00a001820a9a4b5050 to your computer and use it in GitHub Desktop.
How to compute Jaccard Error Rate
# load UEM, references, and system output
from pyannote.database.util import load_rttm, load_uem
uems = load_uem('references.uem')
references = load_rttm('references.rttm')
hypotheses = load_rttm('hypotheses.rttm')
from pyannote.metrics.diarization import JaccardErrorRate
metric = JaccardErrorRate()
# compute (and print) JER for each file
for uri, hypothesis in hypotheses.items():
reference = references[uri]
uem = uems[uri]
jer = metric(reference, hypothesis, uem=uem)
print(f'{uri} {jer:.3f}')
# compute (and print) JER aggregated on all files
print(f'all {abs(metric)}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment