mlonmcu
Tool for the deployment and analysis of TinyML applications on TFLM and MicroTVM backends
Science Score: 85.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README -
✓Academic publication links
Links to: acm.org -
✓Committers with academic emails
4 of 11 committers (36.4%) from academic institutions -
✓Institutional organization owner
Organization tum-ei-eda has institutional domain (www.eda.ei.tum.de) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.6%) to scientific vocabulary
Repository
Tool for the deployment and analysis of TinyML applications on TFLM and MicroTVM backends
Basic Info
- Host: GitHub
- Owner: tum-ei-eda
- License: apache-2.0
- Language: Python
- Default Branch: main
- Size: 22.2 MB
Statistics
- Stars: 35
- Watchers: 6
- Forks: 14
- Open Issues: 72
- Releases: 0
Metadata Files
README.md
ML on MCU
This project contains research code related to the deployment of inference or learning applications on tiny micro-controllers.
- Free software: Apache License, Version 2.0
- Python Package: https://pypi.org/project/mlonmcu/
- Documentation: https://mlonmcu.readthedocs.io or https://tum-ei-eda.github.io/mlonmcu/
Features
- Highly configurable python package
- Automatic resolution and installation of dependencies
- Supporting a large combination of frameworks/backends/targets/features
- Build-in parallel processing of large number of benchmarks
- Isolated enironments (not interfering with other installations)
- Command Line and Python Development Interfaces
- Docker images to get started quickly
- Extensive documentation on usage and code details
- CI/CD integration and high PyTest coverage
Getting started
Prerequisites
Ubuntu/Debian
First, a set of APT packages needs to be installed:
```
Python related
sudo apt install python3-pip python3-venv
MLonMCU related
sudo apt install libboost-all-dev graphviz doxygen libtinfo-dev zlib1g-dev texinfo unzip device-tree-compiler tree g++
Optional (depending on configuration)
sudo apt install ninja-build flex lsb-release libelf-dev ```
Also make sure that your default Python is at least v3.7. If the python command is not available in your shell or points Python v2.7 check out python-is-python3.
Warning: It seems like the ETISS tool fails to compile if if find a version of LLVM 11 on your system which does not include Clang 11. The best workaround for now is to (if possible) remove those tools from your system: sudo apt remove llvm-11* clang-11* (See issue #1)
Make sure to use a fresh virtual Python environment in the following steps.
Install Release from PyPI
Warning: As the PyPI package is not always up to date, it is currently recommented to use a self-build version of the package (as explained in the next section)
To use the PIP package, run the following: pip install mlonmcu (Add --user if you are not using a virtual environment)
Build Package manually
First, install all relevant dependencies:
``` python -m venv .venv # Feel free to choose a different directory or use a conda environment
Run this whenever your have updated the repository
source .venv/bin/activate
Environment-specific dependencies are installed later
Warning: It is recommended to have at least version 3.20 of CMake installed for full compatibility!
Install ptional dependecies (only for development)
pip install -r requirements_dev.txt pip install -r docs/requirements.txt
Only if you want to use the provided python notebooks, as explained in ./ipynb/README.md
pip install -r ipynb/requirements.txt ```
Then you should be able to install the mlonmcu python package like this
```
Optionally remove an older version first: pip uninstall mlonmcu
make install # Alternative: python setup.py install ```
Docker (Any other OS)
See ./docker/README.md for more details.
This repository ships three different types of docker images based on Debian:
- A minimal one with preinstalled software dependencies and python packages
Feel free to use this one if you do not want to install anything (except Docker) on your main sytem to work with mlonmcu
- A medium one which already has the mlonmcu python package installed
Recommended and the easiest to use. (Especially when using docker-compose to mount shared directories etc.)
- A very large one with an already initialized and installed
Mainly used for triggering automated benchmarks without spending too much time on downloading/compiling heavy dependencies over and over again.
Usage
Is is recommended to checkout the provided Demo Jupyter Notebook as it contains a end-to-end example which should help to understand the main concepts and methodology of the tool. The following paragraphs can be seen as a TL;DL version of the information in that Demo notebook.
While some tools and features of this project work out of the box, some of them require setting up an environment where additional dependencies are installed. This can be achived by creating a MLonMCU environment as follows:
bash
mlonmcu init
Make sure to point the MLONMCU_HOME environment variable to the location of the previously initialied environment. (Alternative: use the default environment or --home argument on the command line)
Next, generate a requirements_addition.txt file inside the environment directory using mlonmcu setup -g which now be installed by running pip install -r $MLONMCU_HOME/requirements_addition.txt inside the virtual Python environment.
To use the created environment in a python program, a MlonMcuContext needs to be created as follows:
``` import mlonmcu.context
with mlonmcu.context.MlonMcuContext() as context: pass ```
List of interesting MLonMCU forks
- MINRES TGC support: https://github.com/Minres/mlonmcu/tree/develop
List of existing MLonMCU extensions/plugins
- ABC Example Plugin: coming soon!
- MINRES TGC Support: coming soon!
Development
Make sure to first install the additonal set of development Python packages into your virtual environment:
pip install -r requirements_dev.txt # Building distributions and running tests
pip install -r docs/requirements.txt # For working with the documentation
Unit test and integration test are defined in the tests/ directory and can be triggered using make test or pytest tests/
Coverage can be determined by running make coverage. The latest coverage report (HTML) for the default branch can also be found as an artifact of the CI/CD workflow.
Documentation is mainly generated automatically from doctrings (triggered via make html). It is also possible to include markdown files from the repo into the .rst files found in the docs/ directory. There is a GitHub workflow which publishes the documentation for the default branch to our GitHub Pages.
Regarding coding style, it is recommended to run black before every commit. The default line length should be given in the setup.cfg file.
Developers
Rafael Stahl (TUM) [@rafzi]
- Wrote initial version of the MLonMCU project
Philipp van Kempen (TUM) [@PhilippvK]
- Came up with MLonMCU Python package
Publications
- MLonMCU: TinyML Benchmarking with Fast Retargeting (https://dl.acm.org/doi/10.1145/3637543.3652878)
CODAI '23: Proceedings of the 2023 Workshop on Compilers, Deployment, and Tooling for Edge AI
BibTeX
bibtex
@inproceedings{10.1145/3615338.3618128,
author = {van Kempen, Philipp and Stahl, Rafael and Mueller-Gritschneder, Daniel and Schlichtmann, Ulf},
title = {MLonMCU: TinyML Benchmarking with Fast Retargeting},
year = {2024},
isbn = {9798400703379},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3615338.3618128},
doi = {10.1145/3615338.3618128},
abstract = {While there exist many ways to deploy machine learning models on microcontrollers, it is non-trivial to choose the optimal combination of frameworks and targets for a given application. Thus, automating the end-to-end benchmarking flow is of high relevance nowadays. A tool called MLonMCU is proposed in this paper and demonstrated by benchmarking the state-of-the-art TinyML frameworks TFLite for Microcontrollers and TVM effortlessly with a large number of configurations in a low amount of time.},
booktitle = {Proceedings of the 2023 Workshop on Compilers, Deployment, and Tooling for Edge AI},
pages = {32–36},
numpages = {5},
keywords = {TinyML, neural networks, microcontrollers},
location = {Hamburg, Germany},
series = {CODAI '23}
}
Other
This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage_ project template. However most of the templates was manually changed to be in Markdown instead of reStructuredText.
- Cookiecutter: https://github.com/audreyr/cookiecutter
audreyr/cookiecutter-pypackage: https://github.com/audreyr/cookiecutter-pypackage
Acknowledgment

This research is partially funded by the German Federal Ministry of Education and Research (BMBF) within the projects Scale4Edge (grant number 16ME0127) and MANNHEIM-FlexKI (grant number 01IS22086L).
Owner
- Name: EDA@TUM
- Login: tum-ei-eda
- Kind: organization
- Email: eda@ei.tum.de
- Location: Munich, Germany
- Website: www.eda.ei.tum.de
- Repositories: 29
- Profile: https://github.com/tum-ei-eda
Open Source Repository of the Chair of Electronic Design Automation, TU Munich
Citation (CITATION.cff)
cff-version: 1.2.0
message: If you use this software, please cite both the article from preferred-citation and the software itself.
authors:
- family-names: van Kempen
given-names: Philipp
- family-names: Stahl
given-names: Rafael
- family-names: Mueller-Gritschneder
given-names: Daniel
title: 'MLonMCU: TinyML Benchmarking with Fast Retargeting'
version: v0.2.0
repository-code: 'https://github.com/tum-ei-eda/mlonmcu'
url: 'https://tum-ei-eda.github.io/mlonmcu/'
repository-artifact: 'https://pypi.org/project/mlonmcu/'
date-released: '2022-10-13'
license: Apache-2.0
preferred-citation:
authors:
- family-names: van Kempen
given-names: Philipp
- family-names: Stahl
given-names: Rafael
- family-names: Mueller-Gritschneder
given-names: Daniel
- family-names: Schlichtmann
given-names: Ulf
title: 'MLonMCU: TinyML Benchmarking with Fast Retargeting'
doi: 10.1145/3615338.3618128
url: https://doi.org/10.1145/3615338.3618128
type: conference-paper
pages: 32–36
year: '2024'
isbn: '9798400703379'
collection-title: Proceedings of the 2023 Workshop on Compilers, Deployment, and Tooling for Edge AI
conference:
name: CODAI '23
publisher:
name: Association for Computing Machinery
address: New York, NY, USA
GitHub Events
Total
- Create event: 25
- Release event: 1
- Issues event: 9
- Watch event: 4
- Delete event: 7
- Issue comment event: 5
- Push event: 140
- Pull request review event: 4
- Pull request review comment event: 9
- Pull request event: 25
- Fork event: 2
Last Year
- Create event: 25
- Release event: 1
- Issues event: 9
- Watch event: 4
- Delete event: 7
- Issue comment event: 5
- Push event: 140
- Pull request review event: 4
- Pull request review comment event: 9
- Pull request event: 25
- Fork event: 2
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 1,225
- Total Committers: 11
- Avg Commits per committer: 111.364
- Development Distribution Score (DDS): 0.194
Top Committers
| Name | Commits | |
|---|---|---|
| Philipp van Kempen | p****n@t****e | 987 |
| Philipp v. K | p****n@g****m | 133 |
| Xinyu Zhou | z****3@o****m | 29 |
| Rafael Stahl | r****l@t****e | 18 |
| Xinyu Zhou | g****t@m****e | 16 |
| Philipp van Kempen | p****n@g****m | 16 |
| Zhou | g****t@r****e | 10 |
| Philipp van Kempen | p****p@P****x | 7 |
| Rafael Stahl | d****f@w****e | 7 |
| Philipp van Kempen | p****p@P****l | 1 |
| Xinyu Zhou | 5****3@u****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 96
- Total pull requests: 108
- Average time to close issues: 4 months
- Average time to close pull requests: 2 months
- Total issue authors: 4
- Total pull request authors: 8
- Average comments per issue: 1.08
- Average comments per pull request: 0.46
- Merged pull requests: 78
- Bot issues: 0
- Bot pull requests: 18
Past Year
- Issues: 12
- Pull requests: 34
- Average time to close issues: 3 months
- Average time to close pull requests: 25 days
- Issue authors: 1
- Pull request authors: 4
- Average comments per issue: 0.08
- Average comments per pull request: 0.12
- Merged pull requests: 20
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
- PhilippvK (91)
- rafzi (1)
- zhouxinyu0723 (1)
- vladBaciu (1)
Pull Request Authors
- PhilippvK (89)
- github-actions[bot] (26)
- rafzi (9)
- zhouxinyu0723 (5)
- SamiraAFg (2)
- janschafrich (2)
- jv-jithin (1)
- Cecil-W (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 77 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 15
- Total maintainers: 1
pypi.org: mlonmcu
This project contains research code related to the deployment of inferenceor learning applications on tiny micro-controllers.
- Homepage: https://github.com/tum-ei-eda/mlonmcu
- Documentation: https://mlonmcu.readthedocs.io/
- License: Apache License 2.0
-
Latest release: 0.7.0
published 10 months ago
Rankings
Maintainers (1)
Dependencies
- GitPython *
- Pillow *
- bitstring >=3.1.6
- click >=7.0
- cloudpickle *
- construct ==2.10.54
- cryptography >=2.1.4
- decorator *
- ecdsa >=0.16.0
- filelock *
- future >=0.15.2
- gdbgui ==0.13.2.0
- graphviz *
- humanize *
- idf-component-manager *
- jinja2 *
- kconfiglib ==13.7.1
- matplotlib *
- networkx *
- numpy *
- openpyxl *
- pandas *
- psutil *
- pyelftools *
- pygdbmi <=0.9.0.2
- pyparsing >=2.0.3,<2.4.0
- pyserial *
- python-socketio <5
- pyyaml *
- reedsolo >=1.5.3,<=1.5.4
- scipy *
- synr *
- tensorflow *
- tflite *
- tornado *
- tqdm *
- xdg *
- xgboost *
- xlsxwriter *
- xlwt *
- Sphinx >=4.3.2
- myst-parser ==0.16.1
- numpydoc *
- sphinx_rtd_theme *
- sphinxemoji *
- matplotlib *
- notebook *
- black >=22.1.0
- bump2version ==0.5.11
- coverage *
- flake8 ==3.7.8
- pip >=21.1
- pylint *
- pytest ==6.2.5
- pytest-console-scripts ==1.2.1
- tox ==3.14.0
- twine *
- wheel ==0.33.6
- JamesIves/github-pages-deploy-action 4.1.1 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v2 composite
- RubbaBoy/BYOB v1.2.1 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v2 composite
- peaceiris/actions-gh-pages v3 composite
- pypa/gh-action-pypi-publish release/v1 composite
- ASzc/change-string-case-action v1 composite
- actions/checkout v3 composite
- docker/build-push-action v2 composite
- docker/login-action v1 composite
- docker/setup-buildx-action v1 composite
- docker/setup-qemu-action v1 composite
- ASzc/change-string-case-action v5 composite
- actions/checkout v3 composite
- docker/build-push-action v4 composite
- docker/login-action v2 composite
- docker/setup-buildx-action v2 composite
- docker/setup-qemu-action v2 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v2 composite
- actions/upload-artifact v2 composite
- ASzc/change-string-case-action v5 composite
- actions/checkout v3 composite
- docker/build-push-action v4 composite
- docker/login-action v2 composite
- docker/setup-buildx-action v2 composite
- docker/setup-qemu-action v2 composite
- ASzc/change-string-case-action v5 composite
- actions/checkout v3 composite
- docker/build-push-action v4 composite
- docker/login-action v2 composite
- docker/setup-buildx-action v2 composite
- docker/setup-qemu-action v2 composite
- easimon/maximize-build-space master composite
- actions/checkout v3 composite
- actions/create-release v1 composite
- metcalfc/changelog-generator v0.4.3 composite
- pypa/gh-action-pypi-publish release/v1 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- wearerequired/lint-action v1 composite
- debian bullseye build
- mlonmcu latest build
- mlonmcu-ci latest build
- tumeda/mlonmcu latest
- PrettyTable *
- bitstring >=3.1.6
- click >=7.0
- cloudpickle *
- construct ==2.10.54
- cryptography >=2.1.4
- decorator *
- ecdsa >=0.16.0
- filelock *
- future >=0.15.2
- gdbgui ==0.13.2.0
- graphviz *
- idf-component-manager *
- itsdangerous <2.1
- jinja2 <3.1
- kconfiglib ==13.7.1
- matplotlib *
- networkx *
- numpy *
- onnx *
- openpyxl *
- ortools *
- psutil *
- pygdbmi <=0.9.0.2
- pyparsing >=2.0.3,<2.4.0
- pyserial *
- python-socketio <5
- pyusb *
- reedsolo >=1.5.3,<=1.5.4
- scipy *
- synr *
- tensorflow >=2.11.1
- tflite *
- tornado *
- tqdm *
- xgboost *
- xlsxwriter *
- xlwt *