You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

⚠️ 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.

Use Cases:

  • Optical Music Recognition (OMR): system-level, full-page
  • Image Segmentation: music regions

Dataset Details

Each page includes the corresponding **kern data for that specific page. Additionally, it provides detailed annotations for each region within the page.

1. Image

  • Type: PNG
  • Description: Encoded full-page image of the score.

2. Original Width

  • Type: Integer
  • Description: The width of the image in pixels.

3. Original Height

  • Type: Integer
  • Description: The height of the image in pixels.

4. Regions

  • Type: List of JSON objects
  • Description: Contains detailed information about regions on the page. Each JSON object includes:
    • bbox:
      • x: The vertical position on the page (in pixels).
      • y: The horizontal position on the page (in pixels).
      • width: Width of the region (in pixels).
      • height: Height of the region (in pixels).
      • raw: The content extracted from the original dataset before any processing.
      • kern: A standardized version of the content ready for rendering.
      • ekern: A tokenized and standardized version of the content for enhanced processing.

5. Page Texture

  • Type: String
  • Description: The musical texture of the page.
  • Values:
    • "Pianoform"
    • "Monophonic"
    • "Other"

6. Page

  • Type: JSON object
  • Description: Metadata of the page. Fields include:
    • raw: The unprocessed content extracted from the original dataset.
    • kern: The content in a standardized format, ready to be rendered.
    • ekern: The content in a tokenized and standardized format.

7. Score ID

  • Type: String
  • Description: Unique identifier for the original score to which the page belongs.

SMB usage 📖

SMB is publicly available at HuggingFace.

To download from HuggingFace:

  1. Gain access to the dataset and get your HF access token from: https://huggingface.co/settings/tokens.
  2. 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.
  3. 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
174