Giter Site home page Giter Site logo

driedler / tflite_micro_runtime Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tensorflow/tflite-micro

10.0 1.0 2.0 10.06 MB

TensorFlow Lite for Microcontrollers Python package for Raspberry Pi Zero

License: Apache License 2.0

Starlark 3.60% C 5.03% C++ 71.10% Makefile 1.39% Jupyter Notebook 7.48% Shell 1.79% Python 8.40% PHP 0.42% Pascal 0.41% Assembly 0.11% CMake 0.17% Mako 0.09%
tensorflow tensorflow-lite tensorflow-lite-micro tflm tflite python raspberry-pi raspberry-pi-zero tflite-runtime

tflite_micro_runtime's Introduction

tflite_micro_runtime

This allows for running TF-Lite models on a RaspberryPi Zero using the Tensorflow-Lite Micro (TFLM) interpreter.

This provides the Python package:tflite_micro_runtime which uses the same API as tflite_runtime. The main difference is tflite_micro_runtime uses the Tensorflow-Lite Micro interpreter instead of the Tensorflow-Lite interpreter.

Using the Tensorflow-Lite Micro (TFLM) interpeter provides ~8x improvement on inference time.
TFLM provides a speedup because it uses the ARM CMSIS NN library which is optimized for ARMv6 processor that RPI0 uses. The RPI0's ARMv6 processor does not have a GPU or other hardware optimizations so can not leverage any of the features that come with the tflite_runtime library. Thus the tflite_micro_runtime library is faster on the RPI0 but not other Raspberry PIs that do feautre a GPU.

More details on the tflite_runtime Python package here:
https://www.tensorflow.org/lite/guide/python

More details on the Tensorflow-Lite Micro interpreter here:
https://github.com/tensorflow/tflite-micro

NOTE: This repo is a fork of the tflite-micro repo.

Install

To install the tflite_micro_runtime Python package, run the PIP command on the RPI0:

pip3 install https://github.com/driedler/tflite_micro_runtime/releases/download/1.1.0/tflite_micro_runtime-1.1.0-cp37-cp37m-linux_armv6l.whl

Build

To build the tflite_micro_runtime Python package, run the bash scripts in a Linux environment:

Install Python3

# Install Python3.7, numpy, and pybind11
./tensorflow/lite/micro/tools/rpi0_pip_package/install_python37.sh
# OR Install Python3.9, numpy, and pybind11
./tensorflow/lite/micro/tools/rpi0_pip_package/install_python39.sh

Build Python Package

# Build tflite_micro_runtime wheel
./tensorflow/lite/micro/tools/rpi0_pip_package/build_pip_package37.sh

# OR Build tflite_micro_runtime wheel
./tensorflow/lite/micro/tools/rpi0_pip_package/build_pip_package39.sh

Runtime Comparison Script

A runtime comparsion script is available the compares the tflite_micro_runtime and tflite_runtime packages at: ./tensorflow/lite/micro/python/runtime_comparison.py

Refer to the comments at the top of the script for more details.

tflite_micro_runtime's People

Contributors

advaitjain avatar annietllnd avatar bhanuprakashbv avatar cad-audio avatar cdknorow avatar ddavis-2015 avatar dependabot[bot] avatar deqiangc avatar driedler avatar gerbauz avatar github-actions[bot] avatar j-piecuch avatar jackagoogle avatar jenselofsson avatar jwithers avatar mansnils avatar mike-dooley avatar mocleiri avatar njeffrie avatar patriklaurell avatar petewarden avatar rkuester avatar rockyrhodes avatar rsun-bdti avatar shlmregev avatar tflm-bot avatar tingyan19 avatar vikramdattu avatar yair-ehrenwald avatar yorange1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.