openscore / README.md
zzsi's picture
Upload dataset
bfc65a9 verified
---
license: cc-by-sa-4.0
task_categories:
- image-to-text
language:
- en
tags:
- music
- optical-music-recognition
- omr
- sheet-music
- musicxml
- lilypond
size_categories:
- 10K<n<100K
configs:
- config_name: pages
data_files:
- split: dev
path: pages/dev-*
- split: test
path: pages/test-*
- split: train
path: pages/train-*
- config_name: pages-lieder
data_files:
- split: train
path: pages-lieder/train-*
- split: dev
path: pages-lieder/dev-*
- split: test
path: pages-lieder/test-*
- config_name: pages_transcribed
data_files:
- split: dev
path: pages_transcribed/dev-*
- split: test
path: pages_transcribed/test-*
- split: train
path: pages_transcribed/train-*
- config_name: scores
data_files:
- split: train
path: scores/train-*
- split: test
path: scores/test-*
- split: dev
path: scores/dev-*
dataset_info:
- config_name: pages
features:
- name: image
dtype: image
- name: score_id
dtype: string
- name: corpus
dtype: string
- name: page
dtype: int64
- name: n_pages
dtype: int64
- name: composer
dtype: string
- name: opus
dtype: string
- name: title
dtype: string
splits:
- name: dev
num_bytes: 27048193
num_examples: 339
- name: test
num_bytes: 31131909
num_examples: 478
- name: train
num_bytes: 1181562028
num_examples: 16225
download_size: 977001946
dataset_size: 1239742130
- config_name: pages-lieder
features:
- name: score_id
dtype: string
- name: corpus
dtype: string
- name: page
dtype: int64
- name: n_pages
dtype: int64
- name: bar_start
dtype: int64
- name: bar_end
dtype: int64
- name: musicxml
dtype: string
splits:
- name: train
num_bytes: 511960929
num_examples: 3415
- name: dev
num_bytes: 28971937
num_examples: 195
- name: test
num_bytes: 31504305
num_examples: 218
download_size: 53578761
dataset_size: 572437171
- config_name: pages_transcribed
features:
- name: score_id
dtype: string
- name: corpus
dtype: string
- name: page
dtype: int64
- name: n_pages
dtype: int64
- name: bar_start
dtype: int64
- name: bar_end
dtype: int64
- name: musicxml
dtype: string
- name: image
dtype: image
- name: composer
dtype: string
- name: opus
dtype: string
- name: title
dtype: string
splits:
- name: dev
num_bytes: 81654956
num_examples: 329
- name: test
num_bytes: 89237566
num_examples: 455
- name: train
num_bytes: 3160588563
num_examples: 14129
download_size: 1135929995
dataset_size: 3331481085
- config_name: scores
features:
- name: score_id
dtype: string
- name: composer
dtype: string
- name: opus
dtype: string
- name: title
dtype: string
- name: corpus
dtype: string
- name: instruments
list: string
- name: page
dtype: int64
- name: n_pages
dtype: int64
- name: musicxml
dtype: string
splits:
- name: train
num_bytes: 1468576392
num_examples: 1424
- name: test
num_bytes: 54739890
num_examples: 79
- name: dev
num_bytes: 54992179
num_examples: 79
download_size: 154745773
dataset_size: 1578308461
---
# zzsi/openscore — OpenScore Sheet Music Pages
Rendered sheet music pages from three open-score corpora, paired with
per-page MusicXML ground truth. Intended for optical music recognition (OMR)
research and supervised fine-tuning of vision-language models.
Images are rendered from source MusicXML via
[LilyPond](https://lilypond.org) (Emmentaler font). Per-page MusicXML is
extracted by parsing bar numbers from the rendered SVGs and slicing the source
score with [music21](https://web.mit.edu/music21/).
---
## Corpora
| Corpus | Scores | Instrumentation | Source |
|--------|-------:|-----------------|--------|
| `lieder` | ~1,460 | Voice + piano (3 staves) | [OpenScore/Lieder](https://github.com/OpenScore/Lieder) |
| `quartets` | ~122 | String quartet (4 staves) | [OpenScore/StringQuartets](https://github.com/OpenScore/StringQuartets) |
| `orchestra` | ~94 movements | Full orchestra (10–20+ staves) | [MarkGotham/Hauptstimme](https://github.com/MarkGotham/Hauptstimme) |
---
## Configs
### `pages_transcribed` — image + per-page MusicXML (SFT-ready)
Each row is one rendered page paired with the MusicXML for the bars on that
page. Suitable for supervised fine-tuning of OMR models.
| Split | Rows |
|-------|-----:|
| train | 14,129 |
| test | 455 |
| dev | 329 |
Fields:
| Field | Type | Description |
|-------|------|-------------|
| `image` | PIL.Image | Full-page score render |
| `score_id` | str | Score identifier (e.g. `lc6583477`) |
| `corpus` | str | `lieder`, `quartets`, or `orchestra` |
| `composer` | str | |
| `opus` | str | |
| `title` | str | |
| `page` | int | 1-indexed page number |
| `n_pages` | int | Total pages in the score |
| `bar_start` | int | First bar number on this page |
| `bar_end` | int | Last bar number on this page (inclusive) |
| `musicxml` | str | MusicXML for `bar_start``bar_end` |
---
### `pages` — image only, all corpora
Same rows as `pages_transcribed` but without the `musicxml`, `bar_start`, and
`bar_end` fields. Useful for unsupervised pre-training or image-only tasks.
| Split | Rows |
|-------|-----:|
| train | 16,225 |
| test | 478 |
| dev | 339 |
---
### `scores` — full MusicXML per score
One row per score (not per page). Contains the complete MusicXML for the
entire piece plus metadata.
| Split | Rows |
|-------|-----:|
| train | 1,424 |
| test | 79 |
| dev | 79 |
Fields: `score_id`, `composer`, `opus`, `title`, `corpus`, `instruments`
(list), `page` (total pages), `n_pages`, `musicxml` (full score).
---
## Usage
### Load `pages_transcribed`
```python
from datasets import load_dataset
ds = load_dataset("zzsi/openscore", "pages_transcribed")
example = ds["train"][0]
example["image"].show()
print(example["musicxml"][:500])
```
### Filter by corpus (streaming)
The dataset is sorted by `corpus` within each split, so row groups in the
parquet files are corpus-homogeneous. This means streaming with a corpus
filter is efficient: non-matching row groups are skipped without being
downloaded.
```python
from datasets import load_dataset
# Lieder only
ds = load_dataset("zzsi/openscore", "pages_transcribed",
streaming=True, split="train")
ds = ds.filter(lambda r: r["corpus"] == "lieder")
# Lieder + quartets (no orchestra)
ds = ds.filter(lambda r: r["corpus"] in {"lieder", "quartets"})
```
### Quick subset for testing
```python
# First 100 rows (any corpus)
ds = load_dataset("zzsi/openscore", "pages_transcribed",
streaming=True, split="train")
sample = list(ds.take(100))
```
### Fine-tuning example (Qwen-VL style)
```python
from datasets import load_dataset
ds = load_dataset("zzsi/openscore", "pages_transcribed", split="train")
def to_chat(row):
return {
"messages": [
{"role": "user", "content": [
{"type": "image", "image": row["image"]},
{"type": "text", "text": "Transcribe this sheet music page to MusicXML."},
]},
{"role": "assistant", "content": row["musicxml"]},
]
}
ds = ds.map(to_chat)
```
---
## Construction
1. **Render**: Source MusicXML is converted to LilyPond (`.ly`) format and
rendered to SVG pages using a Docker image containing LilyPond 2.24.
Bar numbers are made visible on every bar (`all-bar-numbers-visible`).
2. **Align**: Bar numbers are parsed from each SVG page to determine which
bars appear on each page.
3. **Slice**: music21 slices the source MusicXML to the bar range for each
page and re-exports it as a self-contained MusicXML fragment.
Pages whose bar numbers could not be reliably parsed (e.g. continuation
pages with no bar number printed) are excluded.
---
## Known Limitations
- **Pickup bars**: Scores with a pickup bar (anacrusis) have an implicit
measure 0 that is accounted for in `bar_start`/`bar_end`.
- **Orchestra page alignment**: Orchestra scores frequently render to a
different page count than the original due to `\RemoveEmptyStaves` in
LilyPond. Alignment is based on bar numbers embedded in the rendered SVG,
not on page index.
- **MusicXML slice quality**: Sliced MusicXML may be missing some cross-page
spanners (slurs, hairpins). Inexpressible rhythms (rare) cause individual
pages to be dropped.
- **Render failures**: ~6% of lieder scores, 3% of quartet scores, and 2
orchestra movements failed to render and are absent from the dataset.
---
## License
Source scores are released under
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
LilyPond renders and derived MusicXML slices carry the same license.
---
## Attribution
- **OpenScore Lieder** — scores transcribed by the OpenScore community:
https://github.com/OpenScore/Lieder
- **OpenScore String Quartets** — scores transcribed by the OpenScore community:
https://github.com/OpenScore/StringQuartets
- **Hauptstimme (Orchestra)** — scores curated by Mark Gotham:
https://github.com/MarkGotham/Hauptstimme
Rendering pipeline uses [LilyPond](https://lilypond.org) and
[music21](https://web.mit.edu/music21/). Dataset construction code:
https://github.com/zhudotexe/CVlization