pyMV2H

A python implementation of MV2H metric


Keywords
cli
License
Unlicense
Install
pip install pyMV2H==1.1.0

Documentation

badge PyPI license PyPI version fury.io

pyMV2H

A pure-python implementation of MV2H metric, the original repo can be found here.

For a more easily use with python frameworks, like PyTorch and Tensorflow we implement this repo.

Usage

Using by shell:

pyMV2H
Usage:
  pyMV2H midi_converter -i <input_dir> -o <output_dir>
  pyMV2H compare_files -g <reference_file> -t <transcription_file> [-a] [-p]
  pyMV2H -h | --help
  pyMV2H --version
Options:
  -h --help                         Show this screen.
  --version                         Show version.
  -o --output                       The output file
  -t                                The transcription file
  -g                                The reference file
  -a                                Align both files
  -p                                Set the DTW insertion and deletion penalties
Examples:
  pyMV2H compare_files -g <reference_file> -t <transcription_file> -a -p 2.35
  pyMV2H midi_converter -i <midi_file> -o <output_dir>
Help:
  For help using this tool, please open an issue on the Github repository:
  https://github.com/lucasmpaim/pyMV2H

Using by python code:

pip install pyMV2H

Convert midi files:

from pyMV2H.converter.midi_converter import MidiConverter as Converter
reference_midi_file = '<midi dir>'
reference_file = '<reference txt output>'

converter = Converter(file=reference_midi_file, output=reference_file)
converter.convert_file()

Compare files:

from pyMV2H.utils.music import Music
from pyMV2H.metrics.mv2h import mv2h

reference_file = Music.from_file('<reference_file_dir>')
transcription_file = Music.from_file('<transcription_file_dir>')

print(mv2h(reference_file, transcription_file))

Citation

Please, cite the original article:

@inproceedings{McLeod:18a,
  title={Evaluating automatic polyphonic music transcription},
  author={McLeod, Andrew and Steedman, Mark},
  booktitle={International Society for Music Information Retrieval Conference (ISMIR)},
  year={2018},
  pages={42--49}
}

Important

For convenience at this point, python version doesn't include support for multi-tempo or chords, this repo is implemented for MIDI AMT's algorithms research, and the original repo doesn't extract this info from MIDI files. ref.

Next Step's

  • Support for multi-tempo

  • Reduce the number of dependencies

  • Add support to chords

  • MusicXML parser

  • Write unit tests

  • Increase the number of Unit Tests

  • Refactor code to be more pythonic