Skip to content

pkg/utensor: add support to RIOT#12805

Merged
fjmolinas merged 3 commits intoRIOT-OS:masterfrom
aabadie:pr/pkg/utensor
Jan 7, 2020
Merged

pkg/utensor: add support to RIOT#12805
fjmolinas merged 3 commits intoRIOT-OS:masterfrom
aabadie:pr/pkg/utensor

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Nov 25, 2019

Contribution description

This PR adapts the uTensor library to RIOT as a package.

The sample application provided in the tests is just an adaption of the example application given in this blog post.
The application is demonstrating how to load a model (model structure + weights) generated from a trained model to determine a digit in an image.
The model is trained using TensorFlow on the MNIST dataset.

The digit image is loaded in the firmware using the recently introduced blob mechanism. There is a helper Python script added to be able to update the digit binary file easily: this script load the test data from the MNIST dataset and, given the index in the list of image, save the image on disk and display its content. This is handy for the user to be able to compare with the value detected by the firmware.

The model files (c++) are automatically generated by the utensor-cli tool and stored in the models subdirectory of the application. These C++ files (model description + weights) are loaded in the application as an external module.

The resulting firmware is quite huge, ~180kiB ROM size, and the package requires C++ support, so a few boards (AVR, MSP430, hifive) cannot be used. It should work on MIPS :)

Testing procedure

The following command should succeed:

make BOARD=<board of your choice> -C tests/pkg_utensor flash test

Issues/PRs references

None

@aabadie aabadie added Type: new feature The issue requests / The PR implemements a new feature for RIOT Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 25, 2019
@aabadie aabadie force-pushed the pr/pkg/utensor branch 3 times, most recently from e182301 to 822c18d Compare November 25, 2019 21:25
@kaspar030
Copy link
Copy Markdown
Contributor

force-pushing a lot...

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Nov 25, 2019

force-pushing a lot...

Indeed, I'm trying to fix the build issues reported by Murdock. Since no one reviewed yet, I think that's ok :)

@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 25, 2019
@aabadie aabadie changed the title pkg/utensor: add port to RIOT pkg/utensor: add support to RIOT Nov 26, 2019
@benpicco benpicco requested a review from josephnoir November 29, 2019 17:49
@fjmolinas fjmolinas added this to the Release 2020.01 milestone Dec 13, 2019
Copy link
Copy Markdown
Contributor

@josephnoir josephnoir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for taking so long. I left a few comments regarding the C++ code and checked that it works on a board here. As far as I can tell the Makefile stuff looks ok.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 6, 2020

Thanks for your initial review @josephnoir. I addressed all your comments. I also noticed that the utensor-cli (used to generated the model/weights ccp files) has been updated but the version on pypi is now broken so I opened uTensor/utensor_cgen#97 to provide a fix.

Copy link
Copy Markdown
Contributor

@josephnoir josephnoir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, tested on Phy-Node (pba-d-01-kw2x). C++ code looks ok, I think, and the module structure fits my understanding.

@aabadie aabadie removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 7, 2020
@aabadie aabadie added CI: run tests If set, CI server will run tests on hardware for the labeled PR CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 7, 2020
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 7, 2020

Since the test application provides an automatic test script, I ran Murdock with CI: run tests enabled and there was only one unrelated failure.

@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: run tests If set, CI server will run tests on hardware for the labeled PR CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 7, 2020
@fjmolinas fjmolinas merged commit 0c93eb0 into RIOT-OS:master Jan 7, 2020
@aabadie aabadie deleted the pr/pkg/utensor branch January 7, 2020 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants