Skip to main content

Training data synthesizer for OMR

Project description

License Apache 2.0 PyPI version Downloads Python Version





Smashcima is a library and framework for synthesizing images containing handwritten music for creating synthetic training data for OMR models.

Try out the demo on 🤗 Huggingface Spaces right now!
Example output with MUSCIMA++ writer no. 28 style:


Install from pypi with:

pip install smashcima

What is Smashcima, and how is it novel?

Smashcima is a Python package primarily intended to be used as part of optical music recognition workflows, esp. with domain adaptation in mind. The target user is therefore a machine-learning, document processing, library sciences, or computational musicology researcher with minimal skills in python programming.

Smashcima is the only tool that simultaneously:

  • synthesizes handwritten music notation,
  • produces not only raster images but also segmentation masks, classification labels, bounding boxes, and more,
  • synthesizes entire pages as well as individual symbols,
  • synthesizes background paper textures,
  • synthesizes also polyphonic and pianoform music images,
  • accepts just MusicXML as input,
  • is written in Python, which simplifies its adoption and extensibility.

Therefore, Smashcima brings a unique new capability for optical music recognition (OMR): synthesizing a near-realistic image of handwritten sheet music from just a MusicXML file. As opposed to notation editors, which work with a fixed set of fonts and a set of layout rules, it can adapt handwriting styles from existing OMR datasets to arbitrary music (beyond the music encoded in existing OMR datasets), and randomize layout to simulate the imprecisions of handwriting, while guaranteeing the semantic correctness of the output rendering. Crucially, the rendered image is provided also with the positions of all the visual elements of music notation, so that both object detection-based and sequence-to-sequence OMR pipelines can utilize Smashcima as a synthesizer of training data.

(In combination with the LMX canonical linearization of MusicXML, one can imagine the endless possibilities of running Smashcima on inputs from a MusicXML generator.)

Getting started (User documentation)

To quickly learn how to start using Smashcima for your project, start with the tutorials:

  1. Producing music notation images
  2. Changing background texture
  3. Using custom glyphs
  4. Postprocessing

How it works (Technical documentation)

Smashcima is primarily a framework and a set of crafted interfaces for building custom visual-data related synthesizers.

If you feel like improving the library, take a look at the TODO List.

Development

Create a virtual environment and install dependencies:

python3 -m venv .venv
.venv/bin/pip3 install -e .

# to run jupyter notebooks:
.venv/bin/pip3 install -e .[jupyter]

# to run the gradio demo:
.venv/bin/pip3 install -e .[gradio]

Read the Development Setup documentation page to see how to develop, debug, and deploy the project.

Financing

This work has been done by the OmniOMR project within the 2023-2030 NAKI III programme, supported by the Ministry of Culture of the Czech Republic (DH23P03OVV008).

How to cite

There's a publication being written. Until then, you can cite the original Mashcima paper:

Jiří Mayer and Pavel Pecina. Synthesizing Training Data for Handwritten Music Recognition. 16th International Conference on Document Analysis and Recognition, ICDAR 2021. Lausanne, September 8-10, pp. 626-641, 2021.

Contact

Developed and maintained by Jiří Mayer (mayer@ufal.mff.cuni.cz) as part of the Prague Music Computing Group lead by Jan Hajič jr. (hajicj@ufal.mff.cuni.cz).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smashcima-1.1.2.tar.gz (129.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smashcima-1.1.2-py3-none-any.whl (199.9 kB view details)

Uploaded Python 3

File details

Details for the file smashcima-1.1.2.tar.gz.

File metadata

  • Download URL: smashcima-1.1.2.tar.gz
  • Upload date:
  • Size: 129.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for smashcima-1.1.2.tar.gz
Algorithm Hash digest
SHA256 92ea6744df267eea8f9ab05ae172ca97105e386b811c9c0ea4d0aab2b6774c77
MD5 eb8c819206e8cdc037b1c178886e0042
BLAKE2b-256 baed682280443d2409e24fe20c620cd932c9910b582217eeb17991196962d71a

See more details on using hashes here.

File details

Details for the file smashcima-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: smashcima-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 199.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for smashcima-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2fa7190de96d0aec9c6f942ee6f68655fe171d1a2693a71eca8b2569964ab83e
MD5 7c73787bee8b4f85a0aad6110ee69c47
BLAKE2b-256 9c16a4ced2b665740a4eaeebad15f53a7c12b4f4ce1f4b6533dc1404b864ba81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page