File size: 9,431 Bytes
f06b02d
c3b4e27
 
cbec579
c3b4e27
cbec579
c3b4e27
cbec579
 
 
 
 
 
c3b4e27
7372515
cbec579
68a19ed
 
 
 
 
 
 
 
3688cc7
 
bfc65a9
 
3688cc7
 
 
 
 
 
 
 
 
 
 
 
cbec579
 
 
 
 
 
 
 
 
3688cc7
68a19ed
3688cc7
 
68a19ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3688cc7
 
68a19ed
3688cc7
 
68a19ed
3688cc7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfc65a9
 
 
3688cc7
bfc65a9
 
3688cc7
bfc65a9
 
 
 
3688cc7
4a95cfc
 
 
 
 
 
 
 
 
3688cc7
 
 
 
 
 
 
 
4a95cfc
 
 
 
 
 
 
 
3688cc7
 
4a95cfc
3688cc7
 
4a95cfc
3688cc7
 
 
 
4a95cfc
cbec579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f06b02d
c3b4e27
7372515
c3b4e27
7372515
 
 
 
 
 
 
 
 
 
c3b4e27
 
 
7372515
 
 
 
 
 
 
c3b4e27
7372515
c3b4e27
7372515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c3b4e27
 
 
7372515
 
c3b4e27
 
7372515
 
c3b4e27
 
7372515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c3b4e27
 
7372515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c3b4e27
 
7372515
 
 
 
 
c3b4e27
 
 
7372515
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
---
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