• Stars
    star
    867
  • Rank 52,618 (Top 2 %)
  • Language
    C#
  • Created about 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

TensorFlow Lite Samples on Unity

TensorFlow Lite for Unity Samples

npm

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

Tested on

  • iOS / Android / macOS / Windows / Linux
  • Unity 2021.3.24f1
  • TensorFlow 2.12.0

Included examples:

  • TensorFlow
    • MNIST
    • SSD Object Detection
    • DeepLab
    • PoseNet
    • Style Transfer
    • Text Classification
    • Bert Question and Answer
    • Super Resolution
  • MediaPipe
    • Hand Tracking
    • Blaze Face
    • Face Mesh
    • Blaze Pose (Full body)
    • Selfie Segmentation

Included prebuilt libraries:

iOS Android macOS Ubuntu Windows
Core CPU βœ… βœ… βœ… βœ… βœ…
Metal Delegate βœ… - βœ… - -
GPU Delegate - βœ… - βœ… Experimental -
NNAPI Delegate - βœ… - - -
  • You need to install OpenGL ES and OpenCL to run GPU Delegate on Linux. See MediaPipe for details.

Install TensorFlow Lite for Unity

  • If you want to try all examples, clone this repository with Git-LFS.
  • If you just need TensorFlow Lite libraries via UPM, open the file Packages/manifest.json and add following lines into scopedRegistries and dependencies section.
{
  "scopedRegistries": [
    {
      "name": "package.openupm.com",
      "url": "https://package.openupm.com",
      "scopes": [
        "com.cysharp.unitask"
      ]
    },
    {
      "name": "npm",
      "url": "https://registry.npmjs.com",
      "scopes": [
        "com.github.asus4"
      ]
    }
  ],
  "dependencies": {
    // Core TensorFlow Lite libraries
    "com.github.asus4.tflite": "2.12.0",
    // Utilities for TFLite
    "com.github.asus4.tflite.common": "2.12.0",
    // Utilities for MediaPipe
    "com.github.asus4.mediapipe": "2.12.0",
    ...// other dependencies
  }
}

Build TensorFlow Lite libraries

Pre-built libraries are included. If you want to build 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, Android and macOS
./build_tflite.py --tfpath ../tensorflow -ios -android -macos

# Build with XNNPACK
./build_tflite.py --tfpath ../tensorflow -macos -xnnpack

TIPS

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

# Filtering logcat only Unity and 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

MIT License

Copyright (c) 2021 Koki Ibukuro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Other Licenses

Model Licenses

πŸ“Œ : Each TensorFlow Lite model might have a different license. Please check the license of the model you use.

More Repositories

1

ARKitStreamer

AR Foundation Remote Debugging Tool for Unity
C#
191
star
2

UnityNativeDialogPlugin

Show iOS/Android native dialog from Unity.
C#
150
star
3

unity-taptic-plugin

iOS TAPTIC Engine Bridge for Unity
C#
131
star
4

unity-neumorphism-ui

Neumophism UI for Unity uGUI
C#
124
star
5

onnxruntime-unity

ONNX Runtime Plugin for Unity
C#
53
star
6

onnxruntime-unity-examples

Examples for ONNX Runtime Unity Plugin
ShaderLab
51
star
7

Kml.swift

Simple kml parser for swift
Swift
36
star
8

unity-timeline-sync

Synchronize multiple Unity Timeline via UDP
C#
35
star
9

ARFoundationReplay

AR Record and Playback System on Unity ARFoundation
C
31
star
10

UnityIMU

Unity IMU Analysis
C#
28
star
11

TextureSource

Virtual Texture Source for Unity (WebCam, Video, AR Camera)
C#
27
star
12

UnitySystemInfoViewer

C#
18
star
13

UnityTextureLoader

Runtime Texture Loading for Unity3D
C#
17
star
14

UnitySignageKit

Utilities for Signage, currently mac only
C#
15
star
15

unity-poisson-blending

C#
13
star
16

unity-speech-recognizer

iOS Speech Recognizer for Unity
C#
12
star
17

facial-landmark-annotation

Facial landmark annotation tool
Vue
11
star
18

voice2midi

Go
11
star
19

UnityNativeAudioPlugin

Native Audio Plugin for Unity3D
C++
10
star
20

UnityDiskSpacePlugin

return true disk space for iOS/Android
C#
9
star
21

WorldEnsemble

Play music in the AR World!
ShaderLab
9
star
22

mqtt-unity

C#
7
star
23

depth-prediction-macOS

A Sample App for CoreML in macOS
Swift
7
star
24

SimpleMapper

Simple Mapper is a simple Syphon client for a video installation and a projection mapping.
Objective-C
6
star
25

ObjSeqencer

Play .obj frame animation
C#
6
star
26

go-osc-capture

Go
6
star
27

UnityKonashi

konashi unity wrapper
Objective-C
6
star
28

real-emoji

Vue
5
star
29

UnityGLWireframe

Easy to use GL command
C#
5
star
30

URPPostEffect

C#
5
star
31

unity-headphone-motion-plugin

C#
5
star
32

wiigee_android_test

Test for wiigee gesture recognition library
Java
5
star
33

UnityEventListenerPlugin

Simple event from unity to native code for iOS and Android.
C#
4
star
34

faust-unity-playground

C#
4
star
35

iVidCapPro-test

C#
4
star
36

mock-arfoundation

C#
4
star
37

unity-webrtc-sample

C#
4
star
38

UnityMLGraphView

C#
4
star
39

ARKitStreamerSamples

Samples for ARKitStreamer https://github.com/asus4/ARKitStreamer
C#
4
star
40

ml-slack-bots

Python
4
star
41

google-gemini-unity

C#
4
star
42

BakeAnything

C#
4
star
43

unity-osc-capture

Capture and playback OSC(Open Sound Control) packet in Unity
C#
3
star
44

UnityMusicPlayerPlugin

Access MPMusicPlayerController from Unity
C#
3
star
45

ofxMackerel

openFrameworks wrapper of https://mackerel.io/
C++
3
star
46

unity-arduino-serial

C#
3
star
47

UnityOSC

Unity OSC sample project
C#
3
star
48

acc-beatdetect-js

accelerometer beat detection test
JavaScript
3
star
49

unity-video-supported-plugin

Check iOS/Android supported video format from unity
C#
3
star
50

UnityFileDialog

Open the native file open/save dialog
Objective-C
2
star
51

unity-timeline2qc

Unity Timeline to QuartzComposer
C#
2
star
52

CoreML-DeepLab-Test

C
2
star
53

LiteRT-Unity-Examples

C#
2
star
54

sinsy-macOS

sinsy xcode project for macOS
C++
2
star
55

TestGetRawTextureData

C#
2
star
56

SimpleVJ

Let's VJ, with only Drag and Drop.
Objective-C
2
star
57

UnityMackerel

Unity wrapper of https://mackerel.io/
C#
2
star
58

ARKitStreamerURP

Mathematica
2
star
59

MoFace

Morph face and voice on Web.
JavaScript
2
star
60

ARFoundationReplayGeospatial

C#
2
star
61

mouse-dictionary-de-en

Custom Mouse Dictionary for Deutsch-English
JavaScript
1
star
62

tutorial-ui-hole

C#
1
star
63

twitter-kit-unity-sample

This is a simple sample for Twitter-Kit-Unity
Objective-C
1
star
64

barracuda-samples

C#
1
star
65

HeadphoneMotionTest

Swift
1
star
66

ofxAlgorithmParameterGroup

Make ofxGui controls for cv::Algorithm
C++
1
star
67

quartz_composer_basics

quartz composer basic compositions
1
star
68

unity-background-iOS-test

C#
1
star
69

xmasexp2015

JavaScript
1
star
70

ofxXIMU

Porting XIMU to oF
C++
1
star
71

.cspell

Shell
1
star
72

TextureSourceAR

C#
1
star
73

GasSnippets

Snippets for Google Apps Script
JavaScript
1
star
74

ModoMorphTest

Modo Morph -> FBX -> Unity Test
1
star
75

osc_tools

osc test tools
Python
1
star
76

CinderOpenCv3Sample

OpenCV 3 Tracking API
C++
1
star
77

asus4.github.com

my github pages
1
star
78

tf-lite-builtinrp-test

C#
1
star
79

ARKitMapping

A view dependent rendering example with ARKit
C#
1
star
80

crepe-unity

C#
1
star
81

unity-surround-test

Test 5.1ch and 4ch surround on Unity
C#
1
star
82

ArUcoTool

ArUco maker generator tool
C
1
star
83

UnityProttypeKit

my prototype assets
1
star