- [Mbed cli] pip install mbed-cli
- [uTensor cli] pip install utensor-cgen
- [Treasure Data Client] pip install td-client
- Install Tensorflow (1.9.0 is used in this project)
- Following the instructions and import Mbed OS and other libraries from this repo
mbed import https://www.github.com/BlackstoneEngineering/mbed-os-example-e2e-demo
Specifically,
First, download mbed os and cd mbed-os-example-e2e-demo
Second, configure mbed cloud api key
mbed config CLOUD_SDK_API_KEY
Third, add folder .update-certificates
if there isn't one.
mbed dm init -a mbed_cloud_api_key -d "http://os.mbed.com" --model-name "modelname" -q --force
If need to fetch necessary libraries, mbed deploy
uTensor
is automatically downloaded from step 1 as well. It can also be manually added as following:
mbed add https://github.com/uTensor/uTensor
Or move uTensor.lib
to the folder and mbed deploy
. To have a better understanding of uTensor, here is a great blog to get started.
-
Use Jupyter Notebooks in folder
tensorflow-models
to train models in Tensorflow and save models in .pb files. -
Generate embedded C++ code with utensor-cli and save them in folder
models
utensor-cli convert ./tensorflow-models/mnist_model_0to9/deep_ml.pb --output-nodes=y_pred
-
Replace
main.cpp
inmbed-os-example-e2e-demo
withmain.cpp
in this repo. -
First, compile model that classifies 0 to 4 with Mbed OS
mbed compile --target DISCO_F413ZH --toolchain GCC_ARM --profile=uTensor/build_profile/release.json --flash
-
Flash to the board and run it with
mbed sterm -b 115200
or in Serial terminal. -
The DNN model classifies 0 to 4 correctly but the last 5 digits are predicted wrong.
-
Copy and paste deep_mlp files from the folder
deep_mlp_0to9
and compile again. -
Pelion update the firmware with the model
mbed dm update device -D 016a03d5c97d000000000001001002d8 -m DISCO_F413ZH --build ./BUILD/DISCO_F413ZH/GCC_ARM-RELEASE -vv