Giter VIP home page Giter VIP logo

trylaarsdam / pio-tflite-lib Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 923 KB

A PlatformIO library with the complete and (As of Aug 20, 2023) up-to-date version of Tensorflow Lite for Microcontrollers.

Home Page: https://registry.platformio.org/libraries/trylaarsdam/Tensorflow%20Lite%20for%20Microcontrollers%20(WCL)

C 4.30% C++ 95.70%
arduino platformio tensorflow tensorflow-lite tensorflow-lite-micro tflite

pio-tflite-lib's Introduction

Tensorflow Lite for Microcontrollers

A PlatformIO library with the complete and (As of Aug 20, 2023) up-to-date version of Tensorflow Lite for Microcontrollers.

WARNING: The v1.1.0 library update includes changes to TFLite Micro that removes the AllOpsResolver. You must now use the MicroMutableOpsResolver instead. Depending on your firmware this could be a breaking change.

If you want to build this library for yourself, check out my guide: https://dev.toddr.org/tensorflow-for-the-portenta-h7/

Installation

Install the library via PlatformIO Library Manager.

Examples

There is one example in the examples/basic-inference folder. This example was built for the Arduino Pro Portenta H7, and as such many devices may not be able to fit this example into memory. It is easy to scale down the RAM_SIZE define in that example, and then use your own smaller model. The purpose of having such a large example was to demonstrate that this library supports TFLM's latest features (such as LSTM layers)

If you want a full tutorial check out my dev blog article.

Usage

You can use this library exactly like the TFLite for Microcontrollers documentation describes, located at https://www.tensorflow.org/lite/microcontrollers. You do not need to specically include this library in your project, you can just include the TFLM headers directly, e.x.:

#include "tensorflow/lite/micro/all_ops_resolver.h"

Notes

This library is not officially supported by Google, and is not affiliated with Google in any way. This library was created because I needed to make it for work anyway, and I figured I should share my work. If you have any questions about usage, please open an issue on GitHub or contact me at [email protected], but please check if there are any GH issues before posting/emailing me.

Template project

You can find a template project for this library at @trylaarsdam/pio-tflite. This project has the complete setup for running a model using TFLM, but it is not a library, you can just start editing main.cpp and go.

Supported Operations

This library supports the following Tensorflow Lite operations:

  AddAbs();
  AddAdd();
  AddAddN();
  AddArgMax();
  AddArgMin();
  AddAssignVariable();
  AddAveragePool2D();
  AddBatchToSpaceNd();
  AddBroadcastArgs();
  AddBroadcastTo();
  AddCallOnce();
  AddCast();
  AddCeil();
  AddCircularBuffer();
  AddConcatenation();
  AddConv2D();
  AddCos();
  AddCumSum();
  AddDepthToSpace();
  AddDepthwiseConv2D();
  AddDequantize();
  AddDetectionPostprocess();
  AddDiv();
  AddElu();
  AddEqual();
  AddEthosU();
  AddExp();
  AddExpandDims();
  AddFill();
  AddFloor();
  AddFloorDiv();
  AddFloorMod();
  AddFullyConnected();
  AddGather();
  AddGatherNd();
  AddGreater();
  AddGreaterEqual();
  AddHardSwish();
  AddIf();
  AddL2Normalization();
  AddL2Pool2D();
  AddLeakyRelu();
  AddLess();
  AddLessEqual();
  AddLog();
  AddLogicalAnd();
  AddLogicalNot();
  AddLogicalOr();
  AddLogistic();
  AddLogSoftmax();
  AddMaxPool2D();
  AddMaximum();
  AddMean();
  AddMinimum();
  AddMirrorPad();
  AddMul();
  AddNeg();
  AddNotEqual();
  AddPack();
  AddPad();
  AddPadV2();
  AddPrelu();
  AddQuantize();
  AddReadVariable();
  AddReduceMax();
  AddRelu();
  AddRelu6();
  AddReshape();
  AddResizeBilinear();
  AddResizeNearestNeighbor();
  AddRound();
  AddRsqrt();
  AddSelectV2();
  AddShape();
  AddSin();
  AddSlice();
  AddSoftmax();
  AddSpaceToBatchNd();
  AddSpaceToDepth();
  AddSplit();
  AddSplitV();
  AddSqrt();
  AddSquare();
  AddSquaredDifference();
  AddSqueeze();
  AddStridedSlice();
  AddSub();
  AddSum();
  AddSvdf();
  AddTanh();
  AddTranspose();
  AddTransposeConv();
  AddUnidirectionalSequenceLSTM();
  AddUnpack();
  AddVarHandle();
  AddWhile();
  AddZerosLike();

pio-tflite-lib's People

Contributors

fwittenfeld avatar trylaarsdam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fwittenfeld

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.