MusicScore
收藏资源简介:
该数据集采用CC许可证,主要语言为英语,数据集大小介于100K至1M之间。
This dataset is licensed under CC, uses English as its primary language, and its size ranges from 100K to 1M.
MusicScore: A Dataset for Music Score Modeling and Generation
数据集概述
MusicScore是一个大规模的音乐乐谱数据集,从国际乐谱图书馆项目(IMSLP)收集和处理而来。该数据集包含图像-文本对,其中图像是一页乐谱,文本是音乐的元数据。元数据包括作曲家、乐器、作品风格和音乐类型等丰富信息。
数据集子集
MusicScore数据集被分为三个规模的子集:
| 子集 | 图像数量 |
|---|---|
| MusicScore-400 | 403 |
| MusicScore-14k | 14656 |
| MusicScore-200k | 204800 |
- MusicScore-400:包含19首最受欢迎的钢琴和小提琴作品。
- MusicScore-14k 和 -200k:通过颜色深度和内容过滤图像。对于后者,基于ResNet18训练了一个分类模型。
示例
一个示例样本(IMSLP913207_11.jpg来自MusicScore-400),包含图像及其匹配的元数据存储在一个JSON文件中。
json { "Work Title": "Violin Concerto", "Composer": "Mendelssohn, Felix", "Instrumentation": "violin, orchestra", "Piece Style": "Romantic", "Key": "E minor", "Genre": "Concerto" }
数据集使用示例
用户可以使用以下方法在数据集定义中使用MusicScore-400子集:
python from torch.utils.data import Dataset import json
class MusicScore(Dataset): def init(self): self.meta_path = "/path/to/your/metadata" with open(self.meta_path, r) as f: self.meta_json = json.load(f)
def __getitem__(self, index):
example = {}
image_path = self.instance_data_root[index % self.num_instance_images]
score_id = image_path.split("_")[0]
try:
meta = next(item for item in self.meta_json if item[id] == score_id)
except StopIteration:
print(f"Metadata with score_id {score_id} cannot be found")
raise ValueError
composer, instrumentation, piece_style, key, genre = meta["Composer"], meta["Instrumentation"], meta["Piece Style"], meta["key"], meta["genre"]
example["caption"] = (
f"a music score, composer is {composer}, instrumentation is {instrumentation}, piece style is {piece_style}, key is {key}, genre is {genre}"
)
return example




