Datasets:
⚠️ Work in Progress! SMB: A Multi-Texture Sheet Music Recognition Benchmark ⚠️
Overview
SMB (Sheet Music Benchmark) is a dataset of printed Common Western Modern Notation scores developed at the University of Alicante at the Pattern Recognition and Artificial Intelligence Group.
Dataset Details
- Image Format: PNG
- Encoding Formats: RAW Humdrum **kern, **ekern (standarized **kern version)
- Annotations:
- Segmentation: Bounding boxes
- Music encoding (system-level and full-page): Humdrum **kern
- Use Cases:
- Optical Music Recognition (OMR): system-level, full-page
- Image Segmentation: music regions
SMB usage 📖
SMB is publicly available at HuggingFace.
To download from HuggingFace:
- Gain access to the dataset and get your HF access token from: https://huggingface.co/settings/tokens.
- Install dependencies and login HF:
- Install Python
- Run
pip install pillow datasets huggingface_hub[cli]
- Login by
huggingface-cli login
and paste the HF access token. Check here for details.
- Use the following code to load SMB and extract the regions:
from datasets import load_dataset
from PIL import ImageDraw
import json
def draw_bounding_boxes(row, image):
"""
Draws bounding boxes on an image based on region data provided in the row.
Args:
row (dict): A row from the dataset.
image (PIL.Image): An image object without bounding boxes.
Returns:
PIL.Image: An image with bounding boxes drawn.
"""
# Create a drawing object
draw = ImageDraw.Draw(image)
# Iterate through regions in the row
for index, region in enumerate(json.loads(row["regions"])):
# Extract bounding box data
bbox = region["bbox"]
box_x = bbox["x"] / 100 * row["original_width"]
box_y = bbox["y"] / 100 * row["original_height"]
box_width = bbox["width"] / 100 * row["original_width"]
box_height = bbox["height"] / 100 * row["original_height"]
# Drawing bounding box
top_left = (box_x, box_y)
bottom_right = (box_x + box_width, box_y + box_height)
draw.rectangle([top_left, bottom_right], width=3, outline="red")
# Show region data
print(f"\nregion {index}"
f"\nkern: {region['kern']}")
return image
if __name__ == "__main__":
# Load dataset from Hugging Face
ds = load_dataset("PRAIG/SMB")
# Select a subset of the dataset
ds = ds['train']
# Iterate through rows in the dataset
for row in ds:
# Load the image
image = row["image"]
# Draw bounding boxes on the image
image = draw_bounding_boxes(row, image)
# Show the image and wait for user to close it
image.show()
input("Close the image window and press Enter to continue...")
Citation
If you use our work, please cite us:
@preprint{MartinezSevillaPRAIG24,
author = {Juan C. Martinez{-}Sevilla and
Noelia Luna{-}Barahona and
Joan Cerveto{-}Serrano and
Antonio Rios{-}Vila and
David Rizo and
Jorge Calvo{-}Zaragoza},
title = {A Multi{-}Texture Sheet Music Recognition Benchmark},
year = {2024}
}
- Downloads last month
- 95