1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/pkg_emlearn
MrKevinWeiss 600e9f4e47 tests/pkg*: Add app.config.test to pkg tests
This adds app config to the package tests that are available:

- tests/pkg_c25519
- tests/pkg_cayenne-lpp
- tests/pkg_cifra
- tests/pkg_cn-cbor
- tests/pkg_emlearn
- tests/pkg_hacl
- tests/pkg_heatshrink
- tests/pkg_jsmn
- tests/pkg_libb2
- tests/pkg_libcose
- tests/pkg_libfixmath
- tests/pkg_libhydrogen
- tests/pkg_lora-serialization
- tests/pkg_micro-ecc
- tests/pkg_minmea
- tests/pkg_monocypher
- tests/pkg_nanocbor
- tests/pkg_nanopb
- tests/pkg_qcbor
- tests/pkg_qdsa
- tests/pkg_relic
- tests/pkg_tiny-asn1
- tests/pkg_tinycbor
- tests/pkg_tinycrypt
- tests/pkg_tweetnacl
- tests/pkg_yxml
2021-04-08 16:44:10 +02:00
..
tests tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
.gitignore tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
app.config.test tests/pkg*: Add app.config.test to pkg tests 2021-04-08 16:44:10 +02:00
digit tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
generate_digit.py tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
generate_model.py tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
main.c tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
Makefile tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
Makefile.ci boards: Introduce atxmega-a3bu-xplained board 2021-04-07 20:06:11 -03:00
model tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
README.md tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00
train_model.py tests/pkg_emlearn: add sample application 2020-06-28 21:50:51 +02:00

Emlearn package test application

This application shows how to use a machine learning model with emlearn on RIOT in order to predict a value from a hand written digit image. The model is a Scikit-Learn random forest estimator trained on the MNIST dataset.

Expected output

The default digit to predict is a hand-written '6', so the application output is the following:

Predicted digit: 6

Use the Python scripts

The application comes with 3 Python scripts:

  • generate_digit.py is used to generate a new digit file. This file is embedded in the firmware image and is used as input for the inference engine. Use the -i option to select a different digit. For example, the following command:
    $ ./generate_digit.py -i 1
    
    will generate a digit containing a '9'. The digit is displayed at the end of the script so one knows which digit is stored. Note that each time a new digit is generated, the firmware image must be rebuilt to include this new digit.
  • train_model.py is used to train a new Scikit-Learn Random Forest estimator. The trained model is stored in the model binary file.
    $ ./train_model.py
    
    will just train the model.
  • generate_model.py is used to generate the sonar.h header file from the model binary file. The script is called automatically by the build system when the model binary file is updated.