<commit_before><img align="center" width="400" height="94,358" src="https://user-images.githubusercontent.com/34600369/40580500-74088e4a-6137-11e8-9705-ecac1499b1ce.png">


# Moonlight Optical Music Recognition (OMR) [![Build Status](https://travis-ci.org/tensorflow/moonlight.svg?branch=master)](https://travis-ci.org/tensorflow/moonlight)

An experimental [optical music
recognition](https://en.wikipedia.org/wiki/Optical_music_recognition) engine.

Moonlight reads PNG image(s) containing sheet music and outputs
[MusicXML](https://www.musicxml.com/) or a
[NoteSequence message](https://github.com/tensorflow/magenta/blob/master/magenta/protobuf/music.proto).
MusicXML is a standard sheet music interchange format, and `NoteSequence` is
used by [Magenta](http://magenta.tensorflow.org) for training generative music
models.

Moonlight is not an officially supported Google product.

### Usage

    # Build the OMR command-line tool.
    bazel build moonlight:omr
    # Prints a Score message.
    bazel-bin/moonlight/omr moonlight/testdata/IMSLP00747-000.png<commit_msg>Add pip install to the README<commit_after><img align="center" width="400" height="94,358" src="https://user-images.githubusercontent.com/34600369/40580500-74088e4a-6137-11e8-9705-ecac1499b1ce.png">


# Moonlight Optical Music Recognition (OMR) [![Build Status](https://travis-ci.org/tensorflow/moonlight.svg?branch=master)](https://travis-ci.org/tensorflow/moonlight)

An experimental [optical music
recognition](https://en.wikipedia.org/wiki/Optical_music_recognition) engine.

Moonlight reads PNG image(s) containing sheet music and outputs
[MusicXML](https://www.musicxml.com/) or a
[NoteSequence message](https://github.com/tensorflow/magenta/blob/master/magenta/protobuf/music.proto).
MusicXML is a standard sheet music interchange format, and `NoteSequence` is
used by [Magenta](http://magenta.tensorflow.org) for training generative music
models.

Moonlight is not an officially supported Google product.

### Usage

    # You may want to run this inside a virtualenv.
    pip install -r requirements.txt
    # Build the OMR command-line tool.
    bazel build moonlight:omr
    # Prints a Score message.
    bazel-bin/moonlight/omr moonlight/testdata/IMSLP00747-000.png
{'fraction_non_alphanumeric': 0.11911111111111111, 'fraction_numerical': 0.048, 'mean_word_length': 5.201101928374656, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5743097', 'n_tokens_mistral': 796, 'n_tokens_neox': 715, 'n_words': 165}