zzsi commited on
Commit
7372515
·
verified ·
1 Parent(s): 7f584f8

Add comprehensive README with configs, usage, attribution

Browse files
Files changed (1) hide show
  1. README.md +211 -69
README.md CHANGED
@@ -12,16 +12,16 @@ tags:
12
  - musicxml
13
  - lilypond
14
  size_categories:
15
- - 1K<n<10K
16
  configs:
17
- - config_name: default
18
  data_files:
19
  - split: dev
20
- path: data/dev-*
21
  - split: test
22
- path: data/test-*
23
  - split: train
24
- path: data/train-*
25
  - config_name: pages
26
  data_files:
27
  - split: dev
@@ -30,14 +30,6 @@ configs:
30
  path: pages/test-*
31
  - split: train
32
  path: pages/train-*
33
- - config_name: pages_transcribed
34
- data_files:
35
- - split: dev
36
- path: pages_transcribed/dev-*
37
- - split: test
38
- path: pages_transcribed/test-*
39
- - split: train
40
- path: pages_transcribed/train-*
41
  - config_name: scores
42
  data_files:
43
  - split: train
@@ -47,10 +39,8 @@ configs:
47
  - split: dev
48
  path: scores/dev-*
49
  dataset_info:
50
- - config_name: pages
51
  features:
52
- - name: image
53
- dtype: image
54
  - name: score_id
55
  dtype: string
56
  - name: corpus
@@ -59,6 +49,14 @@ dataset_info:
59
  dtype: int64
60
  - name: n_pages
61
  dtype: int64
 
 
 
 
 
 
 
 
62
  - name: composer
63
  dtype: string
64
  - name: opus
@@ -67,18 +65,20 @@ dataset_info:
67
  dtype: string
68
  splits:
69
  - name: dev
70
- num_bytes: 27048193
71
- num_examples: 339
72
  - name: test
73
- num_bytes: 31131909
74
- num_examples: 478
75
  - name: train
76
- num_bytes: 1181562028
77
- num_examples: 16225
78
- download_size: 977001946
79
- dataset_size: 1239742130
80
- - config_name: pages_transcribed
81
  features:
 
 
82
  - name: score_id
83
  dtype: string
84
  - name: corpus
@@ -87,14 +87,6 @@ dataset_info:
87
  dtype: int64
88
  - name: n_pages
89
  dtype: int64
90
- - name: bar_start
91
- dtype: int64
92
- - name: bar_end
93
- dtype: int64
94
- - name: musicxml
95
- dtype: string
96
- - name: image
97
- dtype: image
98
  - name: composer
99
  dtype: string
100
  - name: opus
@@ -103,16 +95,16 @@ dataset_info:
103
  dtype: string
104
  splits:
105
  - name: dev
106
- num_bytes: 81654956
107
- num_examples: 329
108
  - name: test
109
- num_bytes: 89237566
110
- num_examples: 455
111
  - name: train
112
- num_bytes: 3160588563
113
- num_examples: 14129
114
- download_size: 1135929995
115
- dataset_size: 3331481085
116
  - config_name: scores
117
  features:
118
  - name: score_id
@@ -147,51 +139,201 @@ dataset_info:
147
  dataset_size: 1578308461
148
  ---
149
 
150
- # OpenScoreFull-Page Score Images
151
 
152
- Full-page score images rendered from the [OpenScore](https://github.com/OpenScore)
153
- corpora via [LilyPond](https://lilypond.org), paired with source MusicXML.
 
 
 
 
 
 
 
 
154
 
155
  ## Corpora
156
 
157
- | Corpus | Scores | Staves/system | Source |
158
- |--------|--------|---------------|--------|
159
- | Lieder | ~1,460 | 3 (voice + piano) | [OpenScore/Lieder](https://github.com/OpenScore/Lieder) |
160
- | Quartets | ~122 | 4 (violin I/II + viola + cello) | [OpenScore/StringQuartets](https://github.com/OpenScore/StringQuartets) |
161
- | Orchestra | ~94 movements | 10–20+ (full orchestra) | [MarkGotham/Hauptstimme](https://github.com/MarkGotham/Hauptstimme) |
 
 
162
 
163
- ## Format
164
 
165
- ```python
166
- {
167
- "image": PIL.Image, # full-page score render (LilyPond Emmentaler font)
168
- "score_id": str, # e.g. "lc6583477"
169
- "composer": str,
170
- "opus": str,
171
- "title": str,
172
- "corpus": str, # "lieder" or "quartets"
173
- "instruments": list[str],
174
- "page": int, # 1-indexed
175
- "n_pages": int,
176
- }
177
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
  ## Usage
180
 
 
 
181
  ```python
182
  from datasets import load_dataset
183
- ds = load_dataset("zzsi/openscore")
 
184
  example = ds["train"][0]
185
  example["image"].show()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  ```
187
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  ## License
189
 
190
- Source scores: [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
191
- LilyPond renders: same license as source scores.
 
 
 
192
 
193
  ## Attribution
194
 
195
- - OpenScore Lieder corpus: https://github.com/OpenScore/Lieder
196
- - OpenScore String Quartets: https://github.com/OpenScore/StringQuartets
197
- - OpenScore Orchestra (Hauptstimme): https://github.com/MarkGotham/Hauptstimme
 
 
 
 
 
 
 
 
12
  - musicxml
13
  - lilypond
14
  size_categories:
15
+ - 10K<n<100K
16
  configs:
17
+ - config_name: pages_transcribed
18
  data_files:
19
  - split: dev
20
+ path: pages_transcribed/dev-*
21
  - split: test
22
+ path: pages_transcribed/test-*
23
  - split: train
24
+ path: pages_transcribed/train-*
25
  - config_name: pages
26
  data_files:
27
  - split: dev
 
30
  path: pages/test-*
31
  - split: train
32
  path: pages/train-*
 
 
 
 
 
 
 
 
33
  - config_name: scores
34
  data_files:
35
  - split: train
 
39
  - split: dev
40
  path: scores/dev-*
41
  dataset_info:
42
+ - config_name: pages_transcribed
43
  features:
 
 
44
  - name: score_id
45
  dtype: string
46
  - name: corpus
 
49
  dtype: int64
50
  - name: n_pages
51
  dtype: int64
52
+ - name: bar_start
53
+ dtype: int64
54
+ - name: bar_end
55
+ dtype: int64
56
+ - name: musicxml
57
+ dtype: string
58
+ - name: image
59
+ dtype: image
60
  - name: composer
61
  dtype: string
62
  - name: opus
 
65
  dtype: string
66
  splits:
67
  - name: dev
68
+ num_bytes: 81654956
69
+ num_examples: 329
70
  - name: test
71
+ num_bytes: 89237566
72
+ num_examples: 455
73
  - name: train
74
+ num_bytes: 3160588563
75
+ num_examples: 14129
76
+ download_size: 1135929995
77
+ dataset_size: 3331481085
78
+ - config_name: pages
79
  features:
80
+ - name: image
81
+ dtype: image
82
  - name: score_id
83
  dtype: string
84
  - name: corpus
 
87
  dtype: int64
88
  - name: n_pages
89
  dtype: int64
 
 
 
 
 
 
 
 
90
  - name: composer
91
  dtype: string
92
  - name: opus
 
95
  dtype: string
96
  splits:
97
  - name: dev
98
+ num_bytes: 27048193
99
+ num_examples: 339
100
  - name: test
101
+ num_bytes: 31131909
102
+ num_examples: 478
103
  - name: train
104
+ num_bytes: 1181562028
105
+ num_examples: 16225
106
+ download_size: 977001946
107
+ dataset_size: 1239742130
108
  - config_name: scores
109
  features:
110
  - name: score_id
 
139
  dataset_size: 1578308461
140
  ---
141
 
142
+ # zzsi/openscoreOpenScore Sheet Music Pages
143
 
144
+ Rendered sheet music pages from three open-score corpora, paired with
145
+ per-page MusicXML ground truth. Intended for optical music recognition (OMR)
146
+ research and supervised fine-tuning of vision-language models.
147
+
148
+ Images are rendered from source MusicXML via
149
+ [LilyPond](https://lilypond.org) (Emmentaler font). Per-page MusicXML is
150
+ extracted by parsing bar numbers from the rendered SVGs and slicing the source
151
+ score with [music21](https://web.mit.edu/music21/).
152
+
153
+ ---
154
 
155
  ## Corpora
156
 
157
+ | Corpus | Scores | Instrumentation | Source |
158
+ |--------|-------:|-----------------|--------|
159
+ | `lieder` | ~1,460 | Voice + piano (3 staves) | [OpenScore/Lieder](https://github.com/OpenScore/Lieder) |
160
+ | `quartets` | ~122 | String quartet (4 staves) | [OpenScore/StringQuartets](https://github.com/OpenScore/StringQuartets) |
161
+ | `orchestra` | ~94 movements | Full orchestra (10–20+ staves) | [MarkGotham/Hauptstimme](https://github.com/MarkGotham/Hauptstimme) |
162
+
163
+ ---
164
 
165
+ ## Configs
166
 
167
+ ### `pages_transcribed` — image + per-page MusicXML (SFT-ready)
168
+
169
+ Each row is one rendered page paired with the MusicXML for the bars on that
170
+ page. Suitable for supervised fine-tuning of OMR models.
171
+
172
+ | Split | Rows |
173
+ |-------|-----:|
174
+ | train | 14,129 |
175
+ | test | 455 |
176
+ | dev | 329 |
177
+
178
+ Fields:
179
+
180
+ | Field | Type | Description |
181
+ |-------|------|-------------|
182
+ | `image` | PIL.Image | Full-page score render |
183
+ | `score_id` | str | Score identifier (e.g. `lc6583477`) |
184
+ | `corpus` | str | `lieder`, `quartets`, or `orchestra` |
185
+ | `composer` | str | |
186
+ | `opus` | str | |
187
+ | `title` | str | |
188
+ | `page` | int | 1-indexed page number |
189
+ | `n_pages` | int | Total pages in the score |
190
+ | `bar_start` | int | First bar number on this page |
191
+ | `bar_end` | int | Last bar number on this page (inclusive) |
192
+ | `musicxml` | str | MusicXML for `bar_start`–`bar_end` |
193
+
194
+ ---
195
+
196
+ ### `pages` — image only, all corpora
197
+
198
+ Same rows as `pages_transcribed` but without the `musicxml`, `bar_start`, and
199
+ `bar_end` fields. Useful for unsupervised pre-training or image-only tasks.
200
+
201
+ | Split | Rows |
202
+ |-------|-----:|
203
+ | train | 16,225 |
204
+ | test | 478 |
205
+ | dev | 339 |
206
+
207
+ ---
208
+
209
+ ### `scores` — full MusicXML per score
210
+
211
+ One row per score (not per page). Contains the complete MusicXML for the
212
+ entire piece plus metadata.
213
+
214
+ | Split | Rows |
215
+ |-------|-----:|
216
+ | train | 1,424 |
217
+ | test | 79 |
218
+ | dev | 79 |
219
+
220
+ Fields: `score_id`, `composer`, `opus`, `title`, `corpus`, `instruments`
221
+ (list), `page` (total pages), `n_pages`, `musicxml` (full score).
222
+
223
+ ---
224
 
225
  ## Usage
226
 
227
+ ### Load `pages_transcribed`
228
+
229
  ```python
230
  from datasets import load_dataset
231
+
232
+ ds = load_dataset("zzsi/openscore", "pages_transcribed")
233
  example = ds["train"][0]
234
  example["image"].show()
235
+ print(example["musicxml"][:500])
236
+ ```
237
+
238
+ ### Filter by corpus (streaming)
239
+
240
+ The dataset is sorted by `corpus` within each split, so row groups in the
241
+ parquet files are corpus-homogeneous. This means streaming with a corpus
242
+ filter is efficient: non-matching row groups are skipped without being
243
+ downloaded.
244
+
245
+ ```python
246
+ from datasets import load_dataset
247
+
248
+ # Lieder only
249
+ ds = load_dataset("zzsi/openscore", "pages_transcribed",
250
+ streaming=True, split="train")
251
+ ds = ds.filter(lambda r: r["corpus"] == "lieder")
252
+
253
+ # Lieder + quartets (no orchestra)
254
+ ds = ds.filter(lambda r: r["corpus"] in {"lieder", "quartets"})
255
+ ```
256
+
257
+ ### Quick subset for testing
258
+
259
+ ```python
260
+ # First 100 rows (any corpus)
261
+ ds = load_dataset("zzsi/openscore", "pages_transcribed",
262
+ streaming=True, split="train")
263
+ sample = list(ds.take(100))
264
+ ```
265
+
266
+ ### Fine-tuning example (Qwen-VL style)
267
+
268
+ ```python
269
+ from datasets import load_dataset
270
+
271
+ ds = load_dataset("zzsi/openscore", "pages_transcribed", split="train")
272
+
273
+ def to_chat(row):
274
+ return {
275
+ "messages": [
276
+ {"role": "user", "content": [
277
+ {"type": "image", "image": row["image"]},
278
+ {"type": "text", "text": "Transcribe this sheet music page to MusicXML."},
279
+ ]},
280
+ {"role": "assistant", "content": row["musicxml"]},
281
+ ]
282
+ }
283
+
284
+ ds = ds.map(to_chat)
285
  ```
286
 
287
+ ---
288
+
289
+ ## Construction
290
+
291
+ 1. **Render**: Source MusicXML is converted to LilyPond (`.ly`) format and
292
+ rendered to SVG pages using a Docker image containing LilyPond 2.24.
293
+ Bar numbers are made visible on every bar (`all-bar-numbers-visible`).
294
+ 2. **Align**: Bar numbers are parsed from each SVG page to determine which
295
+ bars appear on each page.
296
+ 3. **Slice**: music21 slices the source MusicXML to the bar range for each
297
+ page and re-exports it as a self-contained MusicXML fragment.
298
+
299
+ Pages whose bar numbers could not be reliably parsed (e.g. continuation
300
+ pages with no bar number printed) are excluded.
301
+
302
+ ---
303
+
304
+ ## Known Limitations
305
+
306
+ - **Pickup bars**: Scores with a pickup bar (anacrusis) have an implicit
307
+ measure 0 that is accounted for in `bar_start`/`bar_end`.
308
+ - **Orchestra page alignment**: Orchestra scores frequently render to a
309
+ different page count than the original due to `\RemoveEmptyStaves` in
310
+ LilyPond. Alignment is based on bar numbers embedded in the rendered SVG,
311
+ not on page index.
312
+ - **MusicXML slice quality**: Sliced MusicXML may be missing some cross-page
313
+ spanners (slurs, hairpins). Inexpressible rhythms (rare) cause individual
314
+ pages to be dropped.
315
+ - **Render failures**: ~6% of lieder scores, 3% of quartet scores, and 2
316
+ orchestra movements failed to render and are absent from the dataset.
317
+
318
+ ---
319
+
320
  ## License
321
 
322
+ Source scores are released under
323
+ [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
324
+ LilyPond renders and derived MusicXML slices carry the same license.
325
+
326
+ ---
327
 
328
  ## Attribution
329
 
330
+ - **OpenScore Lieder** scores transcribed by the OpenScore community:
331
+ https://github.com/OpenScore/Lieder
332
+ - **OpenScore String Quartets** — scores transcribed by the OpenScore community:
333
+ https://github.com/OpenScore/StringQuartets
334
+ - **Hauptstimme (Orchestra)** — scores curated by Mark Gotham:
335
+ https://github.com/MarkGotham/Hauptstimme
336
+
337
+ Rendering pipeline uses [LilyPond](https://lilypond.org) and
338
+ [music21](https://web.mit.edu/music21/). Dataset construction code:
339
+ https://github.com/zhudotexe/CVlization