/tf-lite-unity-sample

TensorFlow Lite Samples on Unity

Primary LanguageC#

TensorFlow Lite for Unity Samples

openupm

Porting of "TensorFlow Lite Examples" to Unity. and some utilities for Unity.

Tested on

  • iOS / Android / macOS / Ubuntu / Windows
  • Unity 2019.4.5f1
  • TensorFlow 2.3.0

Included prebuilt libraries

iOS Android macOS Ubuntu Windows
Core CPU
Metal Delegate - - -
OpenGL Delegate - - - -
NNAPI Delegate - - - -

Install TensorFlow Lite for Unity

  • Clone or Download this repository with examples
  • Or core library is available on OpenUPM

Update TensorFlow Lite

Pre-built libraries are included. If you want to use the latest TFLite,

  1. Clone TensorFlow library
  2. Run ./configure in the TensorFlow library
  3. Run ./build_tflite.py (Python3) to build for each platform
# Update iOS, Andoid and macOS
./build_tflte.py --tfpath ../tensorflow -ios -android -macos
  • To build macOS Metal Delegate on TensorFlow v2.3.0 or later, You need to apply following changes the issue

Misc

[Android] You can see logs from tflite by filtering with "tflite"

adb logcat Unity:V tflite:V "*:S"

Show Cases

MNIST
Mnist

SSD Object Detection
SSD

DeepLab Semantic Segmentation
DeepLab

Style Transfer
styletransfter

Hand Tracking
handtracking

BERT
BERT

License

Samples folder Assets/Samples/* is licensed under MIT

Other licenses