Manuscript Offprint
arXiv:2610.24530An Optical Music Recognition Tool for String Quartets
ABSTRACT
This paper presents an optical music recognition (OMR) system tailored for PDF scores of string quartet pieces. The approach begins with a SegNet-based segmentation model to localize musical regions, followed by convolutional neural networks and image processing techniques to classify and extract musical symbols. To improve rhythmic precision, dynamic programming methods enforce time signature constraints and explicitly handle tuples. Evaluation using a longest common subsequence metric across multiple feature matrices demonstrates robust accuracy in recognizing pitch, onset, duration, and accidentals on a benchmark dataset. Code and data are available at https://github.com/lattellie/25-omr.
1. INTRODUCTION
Optical music recognition (OMR) [1–3] is a fundamental technique in processing music notation. Several challenges remain in OMR, including the alignment of music across multiple instrumental tracks, consistency in bar lengths according to time signatures, and the handling of tuples and irregular rhythmic patterns. For multi-staff OMR, string quartets provide a well-structured and manageable test case. Despite being more compact, they encompass the full range of clefs, key signatures, double stops, and complex rhythmic patterns. This makes them a suitable intermediate step toward more complex scores, allowing us to address the challenges in a controlled setting.
Our system focuses on performing OMR on PDF sheet music of string quartet compositions. Our approach begins with a SegNet model taken directly from the open-source repository at https://github.com/BreezeWhite/oemer [4]. We used this pre-trained model, which forms the foundation for locating staff regions and isolating individual musical elements. Then, we apply a combination of traditional image processing techniques and convolutional neural networks (CNNs) to further refine the detection and classification of individual music symbols. Using OpenCV [5], we implemented a pipeline to classify musical symbols, infer rhythmic structure, correct timing to enforce time signatures, handle tuples, and convert the results into an editable MusicXML format. Also, to address rhythmic accuracy, we incorporate a dynamic programming-based correction step that enforces timing constraints, ensuring that bar lengths are consistent and tuples are correctly interpreted and represented.
We utilize the Annotated Beethoven Corpus (ABC) dataset for evaluation [6]. The number of correctly recognized notes is determined by computing the longest common subsequence (LCS) between the ABC reference and our system's output. This approach better captures the sequential structure of music, addressing a key limitation of Symbol Error Rate (SER) [1,7–9], which does not account for the musical order of events.
We tested the system on the full set of Beethoven's 16 string quartets from the ABC dataset. These PDF scores were converted into high-resolution page images and processed without any manual intervention, serving as a real-world evaluation of system scalability and symbolic consistency across multiple instrument lines.
3. METHOD
Our system builds upon the segmentation model, SegNet, by Oemer, which produces five binary maps indicating the locations of 1) stems, 2) clefs and keys, 3) staff lines, 4) noteheads, and 5) other symbols. From these binary maps, we extract individual musical elements for subsequent integration and rhythm analysis (see Figure 1 for a illustration of the proposed workflow):
© J. Hu, B. Cheng, L. Su. Licensed under a Creative Commons Attribution 4.0 International License (CC BY 4.0). Attribution: J. Hu, B. Cheng, L. Su, “An Optical Music Recognition Tool for String Quartets”, in Extended Abstracts for the Late-Breaking Demo Session of the 26th Int. Society for Music Information Retrieval Conf., Daejeon, South Korea, 2025.
Late-Breaking / Demo Session Extended Abstract, ISMIR 2025 Conference

Oemer SegNet output
Figure 1. The workflow of the proposed OMR system for string quartets.
Clef and accidentals are detected via contours from the SegNet model and classified using a CNN. For key signatures, we use a pattern-matching algorithm to separate and label individual symbols. Due to segmentation limitations for flats and alto clefs, we introduce a YOLO-based detector, which performs more reliably. Future work aims to replace the CNN pipeline entirely with YOLO.
Barlines are identified by scanning vertical lines across the full staff height and applying a pixel-density threshold.
Rests are extracted from the segmentation maps and classified via CNN.
Notes are processed as follows: Noteheads are isolated by filtering the segmentation output; stems are located from notehead corners; pitch is assigned based on vertical position and line intersection. Dots are detected through blob analysis and associated with the nearest notehead. Chords are identified via horizontally aligned notes within stems. Single notes without beams are rhythmically classified using a CNN.
Beams were identified by morphological operations to the original image to isolate their bounding boxes. Rhythmic values were estimated using two distinct methods based on note grouping. For isolated notes not connected to others via beams, a CNN was used to predict rhythmic duration. For groups of notes connected by beams, rhythmic length was inferred based on the vertical height of the beam structure. We employed KNN clustering on beam height measurements across the image to identify representative groupings, which were then mapped to standard rhythmic values (e.g., eighth, sixteenth, thirty-second) based on common music notation conventions.
Two post-processing stages refine the musical structure:
Key signature validation groups isolated accidentals and matches their layout to known key patterns. Majority vote across all four parts ensures quartet-wide consistency.
Rhythmic correction is performed using a two-layer dynamic programming (DP) algorithm. The first layer finds the best segmentation of notes into durations, minimizing a cost based on (1) notational conventions, (2) deviation from initial predictions, and (3) alignment with expected groupings under the time signature. The second layer assigns durations to notes within each group. If the total duration exceeds the assigned span while all notes have the same class, we infer that tuples are present.
| Metric | psda | psd | pda | pd | pa | p |
|---|---|---|---|---|---|---|
| Acc (%) | 72.1 | 72.2 | 74.6 | 74.7 | 84.2 | 84.3 |
Table 1. OMR performance across all Beethoven quartets (241,301 notes in total), grouped by evaluation matrix.
4. RESULTS AND DISCUSSION
We evaluated the output of our optical music recognition system using the ABC dataset as ground truth. Accuracy was measured using a dynamic programming approach that computes the longest common subsequence (LCS) between the predicted and reference note sequences. Each note was represented using combinations of the following four features: p (pitch), s (onset position relative to the bar), d (duration), and a (accidentals). We defined six evaluation configurations by combining these features: psda, psd, pda, pd, pa, and p. In this paper, we focus on three representative matrices: psda, pda, and pa. The difference in accuracy between matrices that include accidentals and those that do not was found to be less significant (less than 0.1%), so matrices without accidentals are excluded from visualization for clarity. Results are shown in Table 1.
Across the 16 Beethoven string quartets the psda configuration achieved an average accuracy of , with a maximum of (Beethoven 5), a minimum of (Beethoven 12), and a median of . In comparison, the pa configuration yielded a higher average accuracy of , with a maximum of (Beethoven 5), a minimum of (Beethoven 14), and a median of . These results suggest that rhythmic and temporal information (onset and duration) are more difficult to recognize accurately than pitch or accidentals. The substantial improvement in accuracy when excluding these dimensions (from psda to pa) indicates that rhythm-related errors are the primary contributor to overall recognition challenges.
5. REFERENCES
[1] A. Ríos-Vila, J. Calvo-Zaragoza, and T. Paquet, “Sheet music transformer: End-to-end optical music recognition beyond monophonic transcription,” in International Conference on Document Analysis and Recognition. Springer, 2024, pp. 20–37.
[2] J. Calvo-Zaragoza, J. C. Martinez-Sevilla, C. Penarrubia, and A. Rios-Vila, “Optical music recognition: Recent advances, current challenges, and future directions,” in International Conference on Document Analysis and Recognition. Springer, 2023, pp. 94–104.
[3] E. van Der Wel and K. Ullrich, “Optical music recognition with convolutional sequence-to-sequence models,” arXiv preprint arXiv:1707.04877, 2017.
[4] Yoyo, C. Liebhardt, and S. Samuel, “Breeze-white/oemer: v0.1.7,” Oct. 2023. [Online]. Available: https://doi.org/10.5281/zenodo.8429346
[5] Itseez, “Open source computer vision library,” https://github.com/itseez/opencv, 2015.
[6] M. Neuwirth, D. Harasim, F. C. Moss, and M. Rohrmeier, “The annotated beethoven corpus (abc): A dataset of harmonic analyses of all beethoven string quartets,” Frontiers in Digital Humanities, vol. 5, no. July, pp. 1–5, 2018. [Online]. Available: https://doi.org/10.3389/fdigh.2018.00016
[7] A. Ríos-Vila and J. C.-Z. David Rizo, José M. Iñesta, “End-to-end optical music recognition for pianoform sheet music,” International Journal on Document Analysis and Recognition (IJDAR), vol. 26, pp. 347–362, 2023.
[8] S. Edirisooriya, H.-W. Dong, J. McAuley, and T. Berg-Kirkpatrick, “An empirical evaluation of end-to-end polyphonic optical music recognition,” arXiv preprint arXiv:2108.01769, 2021.
[9] D. R. Juan C. Martinez-Sevilla, Adrián Roselló and J. Calvo-Zaragoza, “On the performance of optical music recognition in the absence of specific training data,” in Proceedings of the International Society for Music Information Retrieval Conference (ISMIR 2023), 2023, pp. 319–326.