uTensor is an extremely light-weight Deep-Learning Inference framework built on Mbed and Tensorflow:
- TensorFlow to uTensor exporter (planned)
- Tensor Classes
- Operators Classes
- Context, a resource and graph management class
This project is under going constant development. APIs are expected to update rapidly.
- Mbed CLI
- Tensorflow
- tf-node-viewer (Optional, for graph-weight extraction)
- Mbed-os 5.6+ compatible boards with at least 256kb of RAM
- SD Card (Must be LESS than 32 GB)
- SD Card reader for the board (Optional if built into the board)
mbed detect to see which target is connect to the board
mbedls -l to list all supported targets
See mbed_app.json
- Clone the repository
- Run
mbed deployto download all referenced libraries - Insert the prepared SD card to the board (see SD Card Preparation Section)
- Use
mbed compile -t GCC_ARM -m NUCLEO_F767ZI --profile=./build_profile/release.jsonto build for ST NUCLEO F767ZI. Or,mbed compile -t GCC_ARM -m NUCLEO_F767ZI --profile=./build_profile/release.json -fto compile and flash
The test data has to be loaded to the SD card for the default binary to run:
- Install python dependencies
pip install -r requirements.txt(Note: may have to usepip3) - Go to the
[project]\TESTS\scriptsfolder - Run
python3 compileTestData.py. This will create[project]\TESTS\scripts\testDatadirectory. - Copy
[project]\TESTS\scripts\testDatato the root of your SD card.
The quantized weight and input data are stored in the SD. Setting the serial baud rate to 115200, here is what you should see:
Deep MLP on Mbed (Trained with Tensorflow)
running deep-mlp...
PASSED 0.00000000
prediction: 7
Currently, the binary runs the first sample of the MNIST dataset which contains a handwritten digit of number 7. Ths network architecture is a 3-layer Relu based MLP, as shown below:
The related Tensorflow training script please refer to the node-viewer project.
At this time, exporting models to uTensor requires the node-viewer project. This tool is designed to view navigate TensorFlow graphs and export tensors to idx files. The idx files are then used by the uTensor. For further instruction, please refer to this wiki-page.
uTensor-CLI is a tool planned for the next releases. It would streamline the process of moving TensorFlow models to uTensor environment.
