-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dealing with line endings and minor Markdown syntax tweaks (#56)
* Dealing with line endings via dos2unix * Normalize all the line endings * Minor syntax tweaks
- Loading branch information
Showing
2 changed files
with
75 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. | ||
*.c text | ||
*.h text | ||
*.cpp text | ||
*.hpp text | ||
sd-driver.lib text | ||
mbed-os.lib text | ||
LICENSE text | ||
README.md text | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.idx binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,77 @@ | ||
|
||
# uTensor | ||
|
||
## Introduction | ||
|
||
# uTensor | ||
|
||
## Introduction | ||
|
||
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. | ||
|
||
## Requirement | ||
|
||
- [Mbed CLI](https://github.com/ARMmbed/mbed-cli) | ||
- [Tensorflow](https://www.tensorflow.org/install/) | ||
- [tf-node-viewer](https://github.com/neil-tan/tf-node-viewer) (Optional, for graph-weight extraction) | ||
- Mbed-os 5.6+ compatible [boards](https://os.mbed.com/platforms/?mbed-os=25) 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) | ||
|
||
## Finding your target name | ||
|
||
`mbed detect` to see which target is connect to the board | ||
|
||
`mbedls -l` to list all supported targets | ||
|
||
## Configure | ||
|
||
See mbed_app.json | ||
|
||
## Build Steps | ||
|
||
1. Clone the repository | ||
2. Run `mbed deploy` to download all referenced libraries | ||
3. Insert the prepared SD card to the board (see SD Card Preparation Section) | ||
4. Use `mbed compile -t GCC_ARM -m NUCLEO_F767ZI --profile=./build_profile/release.json` to build for ST NUCLEO F767ZI. Or, `mbed compile -t GCC_ARM -m NUCLEO_F767ZI --profile=./build_profile/release.json -f` to compile and flash | ||
|
||
## SD Card Preparation | ||
The test data has to be loaded to the SD card for the default binary to run: | ||
|
||
1. Install python dependencies `pip install -r requirements.txt` (Note: may have to use `pip3`) | ||
1. Go to the `[project]\TESTS\scripts` folder | ||
1. Run `python3 compileTestData.py`. This will create `[project]\TESTS\scripts\testData` directory. | ||
1. Copy `[project]\TESTS\scripts\testData` to the root of your SD card. | ||
|
||
## Expected Output | ||
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](http://yann.lecun.com/exdb/mnist/) which contains a handwritten digit of number 7. Ths network architecture is a 3-layer Relu based MLP, as shown below: | ||
|
||
![alt text](https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mlp_mnist.png "mxnet Handwritten Digit Recognition") | ||
- Context, a resource and graph management class | ||
|
||
This project is under going constant development. APIs are expected to update rapidly. | ||
|
||
## Requirement | ||
|
||
- [Mbed CLI](https://github.com/ARMmbed/mbed-cli) | ||
- [Tensorflow](https://www.tensorflow.org/install/) | ||
- [tf-node-viewer](https://github.com/neil-tan/tf-node-viewer) (Optional, for graph-weight extraction) | ||
- Mbed-os 5.6+ compatible [boards](https://os.mbed.com/platforms/?mbed-os=25) 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) | ||
|
||
## Finding your target name | ||
|
||
`mbed detect` to see which target is connect to the board | ||
|
||
`mbedls -l` to list all supported targets | ||
|
||
## Configure | ||
|
||
See [mbed_app.json](blob/master/mbed_app.json) | ||
|
||
## Build Steps | ||
|
||
1. Clone the repository | ||
2. Run `mbed deploy` to download all referenced libraries | ||
3. Insert the prepared SD card to the board (see SD Card Preparation Section) | ||
4. Use `mbed compile -t GCC_ARM -m NUCLEO_F767ZI --profile=./build_profile/release.json` to build for ST NUCLEO F767ZI. Or, `mbed compile -t GCC_ARM -m NUCLEO_F767ZI --profile=./build_profile/release.json -f` to compile and flash | ||
|
||
## SD Card Preparation | ||
The test data has to be loaded to the SD card for the default binary to run: | ||
|
||
1. Install python dependencies `pip install -r requirements.txt` (Note: may have to use `pip3`) | ||
1. Go to the `[project]\TESTS\scripts` folder | ||
1. Run `python3 compileTestData.py`. This will create `[project]\TESTS\scripts\testData` directory. | ||
1. Copy `[project]\TESTS\scripts\testData` to the root of your SD card. | ||
|
||
## Expected Output | ||
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](http://yann.lecun.com/exdb/mnist/) which contains a handwritten digit of number 7. Ths network architecture is a 3-layer Relu based MLP, as shown below: | ||
|
||
![alt text](https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mlp_mnist.png "mxnet Handwritten Digit Recognition") | ||
|
||
The related Tensorflow training script please refer to the [node-viewer](https://github.com/neil-tan/tf-node-viewer/blob/master/deep_mlp.py) project. | ||
|
||
##Exporting to uTensor | ||
|
||
## Exporting to uTensor | ||
|
||
At this time, exporting models to uTensor requires the [node-viewer](https://github.com/neil-tan/tf-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](https://github.com/neil-tan/uTensor/wiki/Tensorflow-model-exporting-note). | ||
|
||
uTensor-CLI is a tool planned for the next releases. It would streamline the process of moving TensorFlow models to uTensor environment. | ||
|
||
##Reference | ||
## Reference | ||
|
||
- [TensorFlow](https://www.tensorflow.org) | ||
- [Mbed](https://developer.mbed.org) | ||
- [Node-Viewer](https://github.com/neil-tan/tf-node-viewer/) | ||
- [How to Quantize Neural Networks with TensorFlow](https://petewarden.com/2016/05/03/how-to-quantize-neural-networks-with-tensorflow/) | ||
- [mxnet Handwritten Digit Recognition](https://mxnet.incubator.apache.org/tutorials/python/mnist.html) | ||
|
||
|