{"id":13861472,"url":"https://github.com/apacha/MusicScoreClassifier","last_synced_at":"2025-07-14T09:32:00.816Z","repository":{"id":71374248,"uuid":"88656224","full_name":"apacha/MusicScoreClassifier","owner":"apacha","description":"A python script that trains a model that can learn to distinguish between music scores and arbitrary content.","archived":false,"fork":false,"pushed_at":"2019-02-05T10:26:43.000Z","size":117,"stargazers_count":19,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-11T09:49:22.131Z","etag":null,"topics":["android-application","classification","deep-learning","music-scores","optical-music-recognition"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apacha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-18T18:14:26.000Z","updated_at":"2024-06-02T14:54:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"9dc47937-b818-4b78-a031-1711542393ec","html_url":"https://github.com/apacha/MusicScoreClassifier","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/apacha/MusicScoreClassifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apacha%2FMusicScoreClassifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apacha%2FMusicScoreClassifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apacha%2FMusicScoreClassifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apacha%2FMusicScoreClassifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apacha","download_url":"https://codeload.github.com/apacha/MusicScoreClassifier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apacha%2FMusicScoreClassifier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265269308,"owners_count":23737815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-application","classification","deep-learning","music-scores","optical-music-recognition"],"created_at":"2024-08-05T06:01:23.182Z","updated_at":"2025-07-14T09:32:00.739Z","avatar_url":"https://github.com/apacha.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Music Score Classifier\n\nThis repository is the model trainer part of the Mobile Music Score Classifier, which is a mobile Android application that takes the live camera-feed and classifies the image in real-time into either music scores, or something else and displays the result in the application. It is part of a set of three tools:\n\n|[Model Trainer](https://github.com/apacha/MusicScoreClassifier)|[Mobile App](https://github.com/apacha/MobileMusicScoreClassifier)|[Manual Classifier](https://github.com/apacha/ManualMusicScoreClassifier)|\n|:----:|:-----:|:-----:|\n|Trains a deep network to automatically classify images into scores or something else.|Mobile Android application that uses a trained model to perform real-time classification on a mobile device.|A small C#/WPF application that can be used manually classify images, used during evaluation|\n|[![Build Status](https://travis-ci.org/apacha/MusicScoreClassifier.svg?branch=master)](https://travis-ci.org/apacha/MusicScoreClassifier)|[![Build Status](https://travis-ci.org/apacha/MobileMusicScoreClassifier.svg?branch=master)](https://travis-ci.org/apacha/MobileMusicScoreClassifier)|[![Build status](https://ci.appveyor.com/api/projects/status/4715vyioa98eje0k?svg=true)](https://ci.appveyor.com/project/apacha/manualmusicscoreclassifier)|\n|[![codecov](https://codecov.io/gh/apacha/MusicScoreClassifier/branch/master/graph/badge.svg)](https://codecov.io/gh/apacha/MusicScoreClassifier)|||\n\nYou might also be interested to check out my [follow-up work](https://github.com/apacha/MusicSymbolClassifier).\n\n# Running the application\nThis repository contains several scripts that can be used independently of each other. \nBefore running them, make sure that you have the necessary requirements installed. Note that there are two versions, depending on the Deep Learning framework you prefer: Tensorflow/Keras or PyTorch.\n\n## Requirements\n\nThis application has been tested with the following versions, but older and newer versions of Tensorflow and Keras are very likely to work exactly the same:\n\n- Python 3.6\n- Keras 2.2.4\n- Tensorflow 1.11.0 (or optionally tensorflow-gpu 1.11.0)\n\nor\n\n- Python 3.6\n- PyTorch 1.0\n\nOptional: If you want to print the graph of the model being trained, install [GraphViz for Windows](https://graphviz.gitlab.io/_pages/Download/Download_windows.html) via and add /bin to the PATH or run `sudo apt-get install graphviz` on Ubuntu (see https://github.com/fchollet/keras/issues/3210)\n\nWe recommend [Anaconda](https://www.continuum.io/downloads) or \n[Miniconda](https://conda.io/miniconda.html) as Python distribution (we did so for preparing Travis-CI and it worked). To accelerate training even further, you can make use of your GPU, by installing tensorflow-gpu instead of tensorflow\nvia pip (note that you can only have one of them) and the required Nvidia drivers. \n\n## Training the model\n\n`python TrainModel.py` can be used to training the convolutional neural network. \nIt will automatically download and prepare three separate datasets for training with\nKeras and Tensorflow (MUSCIMA dataset of handwritten music scores, \nPascal VOC dataset of general purpose images and an additional dataset that \nwas created for this project, containing 1000 realistic score images and 1000 \nimages of other documents and objects). \n\nThe result of this training is a .h5 (e.g. mobilenetv2.h5) file that contains the trained model.\n\n_Troubleshooting_: If for some reason the download of any of the datasets fails, stop the script, remove the partially\ndownloaded file and restart the script.\n\n## Using a trained model for inference\nYou can download a trained model from [here](https://github.com/apacha/MusicScoreClassifier/releases).\n\nTo classify an image, you can use the `TestModel.py` script and call it like this: `python TextModel.py -c mobilenetv2.h5 -i image_to_classify.jpg`\n\n## Exporting the Model for being used in Tensorflow\n\nSince the Android App only uses Tensorflow, the resulting Keras model (despite having a tensorflow model inside)\nhas to be exported into a Protobuf file. This is a bit cumbersome, because Tensorflow separates between\nthe model description and the actual weights. To get both of them into one file, one has to freeze the model.\n\n`python ExportModelToTensorflow.py --path_to_trained_keras_model vgg.h5` will take the file `vgg.h5` and create\n a file called `output_graph.pb` that is ready to be used in the Android application.\n\n# Additional Dataset\nIf you are just interested in the additional dataset that was created for this project,\nit can be downloaded from [here](https://github.com/apacha/MusicScoreClassifier/releases/download/v1.0/MusicScoreClassificationDataset.zip).\nIf you are using this dataset or the code from this repository, please consider citing the following [publication](https://alexanderpacha.files.wordpress.com/2018/06/icmla-2017-paper-towards-self-learning-optical-music-recognition-published.pdf):\n\n```text\n@InProceedings{Pacha2017a,\n  author    = {Pacha, Alexander and Eidenberger, Horst},\n  title     = {Towards Self-Learning Optical Music Recognition},\n  booktitle = {2017 16th IEEE International Conference on Machine Learning and Applications (ICMLA)},\n  year      = {2017},\n  pages     = {795--800},\n  doi       = {10.1109/ICMLA.2017.00-60},\n}\n```\n\n# License\n\nPublished under MIT License,\n\nCopyright (c) 2019 [Alexander Pacha](http://alexanderpacha.com), [TU Wien](https://www.ims.tuwien.ac.at/people/alexander-pacha)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapacha%2FMusicScoreClassifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapacha%2FMusicScoreClassifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapacha%2FMusicScoreClassifier/lists"}