Git Product home page Git Product logo

stm32-tflm-demos's Introduction

STM32 TensorFlow Lite Micro Demos

Collection of STM32 projects making use of Tensorflow Lite Micro. Examples inspired by the TinyML Book.

Toolchain:

CMake-based. See our template: https://github.com/alxhoff/STM3240G-EVAL-TensorFlow-Hello-World

Supported Examples

Supported Boards

Please consult the manufacturer's website for specs and datasheets.

Running

git clone https://github.com/PhilippvK/stm32-tflm-demos

You need to also pull the sub-repos where the actual examples are stored.

git submodule update --init --recursive

Then switch into the folder where the example you want to deploy is stored. Do not worry about the recursive argument, we have only linked our repos, which are essential in this case.

cd examples/hello_world

OR

cd examples/micro_speech

OR

cd examples/mnist

Then:

mkdir build
cd build
cmake -DTF_COMMIT=37c2bf5016fcbed261476386eced503e907cdc01 ..
make
make flash

Other make targets we provide include make debug and make convert (to convert the *.tflite file into tfite_micro_compiler sources).

Fetching the dependencies (Tensorflow, STM32 Firmware) for the first time can take a very long time. You can either take a break or do the following to speed-up the process when using multiple examples:

export SOME_DIRECTORY=<CHOOSE_SOME_PATH>
git clone --recursive https://github.com/tensorflow/tensorflow.git $SOME_DIRECTORY/tensorflow
git clone https://github.com/mborgerding/kissfft.git $SOME_DIRECTORY/kissfft
git clone https://github.com/STMicroelectronics/STM32CubeF4 $SOME_DIRECTORY/STM32CubeF4
git clone https://github.com/STMicroelectronics/STM32CubeF7 $SOME_DIRECTORY/STM32CubeF7
git clone https://github.com/ARM-software/CMSIS_5.git $SOME_DIRECTORY/CMSIS_5
$SOME_DIRECTORY/tensorflow/tensorflow/lite/tools/make/download_dependencies.sh

After doing this a single time, just replace cmake .. with the following command in the future:

cmake -DTF_SRC=$SOME_DIRECTORY/tensorflow -DSTM32Cube_DIR=$SOME_DIRECTORY/STM32CubeF7 -DARM_CMSIS_SRC=$SOME_DIRECTORY/CMSIS_5 -DKISSFFT_SRC=$SOME_DIRECTORY/kissfft ..

Tipp: Swap out STM32CubeF7 with STM32CubeF4 when building for the F413ZH board!

Compatibility

Due to recent updates of the TF Source tree which have not been implemented for the TFLM Compiler, you have to use Commit 37c2bf5016fcbed261476386eced503e907cdc01 or earlier when cloning the TF repositiory via CMake:

cd build
cmake -DTF_COMMIT=37c2bf5016fcbed261476386eced503e907cdc01 ..

If there are new changes for patched files in the TF Source Tree, they will probably not be merged with the modified file or patches might get overwritten. If something like this occours, please remove the build/_deps/tf-* directories and the CMakeCache.txt and try again!

Documentation

stm32-tflm-demos's People

Contributors

philippvk avatar alxhoff avatar munober avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.