Porting of “TensorFlow Lite Examples” to Unity. and some utilities for Unity.
AI learns control robot arm, finds the cube, grabs it and carry it on another platform. Trained virtually over 30h and 40mln steps. Inside of Unity, we can look at GetForceFromTensorFlow in Assets/BallSpawnController.cs to see what interacting with our model looks like. When you make a graph definition, you’re defining a complex system which has multiple steps.
Tested on
- iOS / Android / macOS / Windows
- Unity 2019.4.24f1
- TensorFlow 2.4.0
Hello, I´m actually studing Game Programing, and for my thesis I´m trying to integrate a pre trained tensorflow model into unity, I first started using tensorflowsharp for my export, I froze a mnist test and could use it into unity, the thing was that I had to use tensorflow 1.5 instead of tensorflow 2.0, also people from the project in github told me it was probably not getting any updates.
Samples
- TensorFlow
- MNIST
- SSD Object Detection
- DeepLab
- PoseNet
- Style Transfer
- Text Classification
- Bert Question and Answer
- MediaPipe
- Hand Tracking
- Blaze Face
- Face Mesh
- Blaze Pose (Upper body)
- MLKit
- Blaze Pose (Full body)
- Meet Segmentation
Included prebuilt libraries
iOS | Android | macOS | Ubuntu | Windows | |
---|---|---|---|---|---|
Core CPU | ✅ | ✅ | ✅ | ✅ | ✅ |
Metal Delegate | ✅ | - | ✅ | - | - |
OpenGL Delegate | - | ✅ | - | - | - |
NNAPI Delegate | - | ✅ | - | - | - |
- All libraries except iOS are targeted 64bit platform: arm64 or x86_64.
Install TensorFlow Lite for Unity
Tensorflow Unity Pro
- Clone this repository with examples
- Need Git-LFS to build for iOS
- The TFLite core library is available on:
- OpenUPM
Runopenupm add com.github.asus4.tflite
from the command line. - Or add git URL from the Package Maneger UI:
https://github.com/asus4/tf-lite-unity-sample.git?path=/Packages/com.github.asus4.tflite
- OpenUPM
Build TensorFlow Lite libraries
Pre-built libraries are included. If you want to build the latest TFLite,
- Clone TensorFlow library
- Run
./configure
in the TensorFlow library - Run
./build_tflite.py
(Python3) to build for each platform
- To build macOS Metal Delegate on TensorFlow v2.3.0 or later, You need to apply following changes the issue
TIPS
[Android] You can see logs from tflite by filtering with “tflite”
Show Cases
MNIST
SSD Object Detection
Tensorflow Unity Ios
DeepLab Semantic Segmentation
Style Transfer
Hand Tracking
BERT
License
Samples folder
Assets/Samples/*
is licensed under MITOther Licenses
- TensorFlow: Apache License 2.0
- MediaPipe: Apache License 2.0
- Some MediaPipe C# codes are based on terryky/tflite_gles_app
Model Licenses
Tensorflow Unity Object Detection
? : Each TensorFlow Lite model might have a different license. Please check the license of the model you use.
Tensorflow Unity Download
- Official TFlite Models
- Bert
- SSD
- DeepLab Lab
- MNIST
- Style Transfer
- PoseNet
- Text classification
- Smart Reply
- MediaPipe Models
- Blaze Pose
- Face Mesh
- Hand Tracking
- Meet Segmentation Model
- Using the modified model from PINTO_model_zoo to remove the custom post-process.