Optical Music Recognition

A Python toolkit for sheet music recognition.

PyClef detects musical symbols in score images and applies MIRP, a staff-referenced inference method, to reconstruct note pitch and export reviewable outputs.

$ pip install pyclef
208 symbol classes
0.4126 mAP
97.5% TRA with MIRP

Overview

Object detection alone is not enough for OMR.

PyClef treats detection as one stage of a larger reconstruction pipeline. The detector locates symbols; MIRP uses the detected clef and staff geometry to infer pitch from relative vertical displacement.

Detection model

The current model uses YOLOv11S trained on 208 DeepScoresV2 Dense classes, with 0.4126 mAP@[0.5:0.95] in the reported evaluation.

MIRP

The Staff-Referenced Musical Inference Method defines a reference note from the clef and staff, then infers the pitch of detected notes.

Workflow

The processing pipeline is explicit and auditable.

01

Detect

Load a PDF or image and detect staves, clefs, notes, rests and related notation symbols.

02

Infer

Use MIRP to convert staff-relative geometry into note names and octaves.

03

Review

Create annotated pages so the recognition result can be inspected visually.

04

Export

Write MIDI, MP3 and synchronized video files when those outputs are selected.

Desktop application

A focused interface for running PyClef locally.

Select a score, choose the desired outputs, set the BPM and run the pipeline. Results are written to a folder named after the input file.

  • PDF, PNG and JPG input
  • Annotated score pages
  • MIDI, MP3 and synchronized video
  • Integrated MIDI player with waterfall preview
PyClef desktop interface in dark mode PyClef desktop interface in light mode