All Projects → mattn → Go Tflite

mattn / Go Tflite

Licence: mit
Go binding for TensorFlow Lite

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Tflite

Coursera Applied Data Science With Python
Repository for coursera specialization Applied Data Science with Python by University of Michigan
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Atari Model Zoo
A binary release of trained deep reinforcement learning models trained in the Atari machine learning benchmark, and a software release that enables easy visualization and analysis of models, and comparison across training algorithms.
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Graph Notebook
Library extending Jupyter notebooks to integrate with Apache TinkerPop and RDF SPARQL.
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Ddpg
Implementation of Deep Deterministic Policy Gradients using TensorFlow and OpenAI Gym
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Text detector
Text detection model that combines Retinanet with textboxes++ for OCR
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Integratedgradients
Python/Keras implementation of integrated gradients presented in "Axiomatic Attribution for Deep Networks" for explaining any model defined in Keras framework.
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Mnist tutorial
A tutorial for MNIST handwritten digit classification using sklearn, PyTorch and Keras.
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Nas fpn tensorflow
NAS-FPN: Learning Scalable Feature Pyramid Architecture for Object Detection.
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Data Science Projects With Python
A Case Study Approach to Successful Data Science Projects Using Python, Pandas, and Scikit-Learn
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Datacollect
A collection of tools to collect and download various data.
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Miscellaneous
Scripts and code examples. Includes Spark notes, Jupyter notebook examples for Spark, Impala and Oracle.
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Ml
Codes related to various ML Hackathons
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Auto Reid And Others
Auto-ReID and Other Person Re-Identification Projects
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Svhnclassifier
A TensorFlow implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks (http://arxiv.org/pdf/1312.6082.pdf)
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Neural networks and cv
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Intrinsic Dimension
Stars: ✭ 197 (-1.01%)
Mutual labels:  jupyter-notebook
Up Down Captioner
Automatic image captioning model based on Caffe, using features from bottom-up attention.
Stars: ✭ 195 (-2.01%)
Mutual labels:  jupyter-notebook
Python For Finance Cookbook
Python for Finance Cookbook, published by Packt
Stars: ✭ 199 (+0%)
Mutual labels:  jupyter-notebook
Pytorch Geometric Yoochoose
This is a tutorial for PyTorch Geometric on the YooChoose dataset
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook
Bilateral solver
Python code for the fast bilateral solver
Stars: ✭ 198 (-0.5%)
Mutual labels:  jupyter-notebook

go-tflite

Go binding for TensorFlow Lite

Usage

model := tflite.NewModelFromFile("sin_model.tflite")
if model == nil {
	log.Fatal("cannot load model")
}
defer model.Delete()

options := tflite.NewInterpreterOptions()
defer options.Delete()

interpreter := tflite.NewInterpreter(model, options)
defer interpreter.Delete()

interpreter.AllocateTensors()

v := float64(1.2) * math.Pi / 180.0
input := interpreter.GetInputTensor(0)
input.Float32s()[0] = float32(v)
interpreter.Invoke()
got := float64(interpreter.GetOutputTensor(0).Float32s()[0])

See _example for more examples

Requirements

  • TensorFlow Lite - This release requires 2.2.0-rc3

Tensorflow Installation

You must install Tensorflow Lite C API. Assuming the source is under /source/directory/tensorflow

$ cd /source/directory/tensorflow
$ bazel build --config opt --config monolithic tensorflow:libtensorflow_c.so

Or to just compile the tensorflow lite libraries:

$ cd /some/path/tensorflow
$ bazel build --config opt --config monolithic //tensorflow/lite:libtensorflowlite.so
$ bazel build --config opt --config monolithic //tensorflow/lite/c:libtensorflowlite_c.so

In order for go to find the headers you must set the CGO_CFLAGS environment variable for the source and libraries of tensorflow. If your libraries are not installed in a standard location, you must also give the go linker the path to the shared librares with the CGO_LDFLAGS environment variable.

$ export CGO_CFLAGS=-I/source/directory/tensorflow
$ export CGO_LDFLAGS=-L/path/to/tensorflow/libaries

If you don't love bazel, you can try Makefile.tflite. Put this file as Makefile in tensorflow/lite/c, and run make. Sorry, this has not been test for Linux or Mac

Then run go build on some of the examples.

Edge TPU

To be able to compile and use the EdgeTPU delegate, you need to install the libraries from here: https://github.com/google-coral/edgetpu

There is also a deb package here: https://coral.withgoogle.com/docs/accelerator/get-started/#1-install-the-edge-tpu-runtime

The libraries from should be installed in a system wide library path like /usr/local/lib The include files should be installed somewhere that is accesable from your CGO include path

For x86:

cd /tmp && git clone https://github.com/google-coral/edgetpu.git && \
cp edgetpu/libedgetpu/direct/k8/libedgetpu.so.1.0 /usr/local/lib/libedgetpu.so.1.0 && \
ln -rs /usr/local/lib/libedgetpu.so.1.0 /usr/local/lib/libedgetpu.so.1 && \
ln -rs /usr/local/lib/libedgetpu.so.1.0 /usr/local/lib/libedgetpu.so && \
mkdir -p /usr/local/include/libedgetpu && \
cp edgetpu/libedgetpu/edgetpu.h /usr/local/include/edgetpu.h && \
cp edgetpu/libedgetpu/edgetpu_c.h /usr/local/include/edgetpu_c.h && \
rm -Rf edgetpu

License

MIT

Author

Yasuhrio Matsumoto (a.k.a. mattn)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].