go-tflite
go-tflite copied to clipboard
Add support for newer tf light
The docs says only 2.2.0-rc3 is supported ... to build this requires an old version of bazel which requires old version of jdk. In short pretty hard to build on recent linux since dependencies arn't easily available.
Will a more recent release of tensorflow work ?
I see newer versions of tensorflow make use of cmake. So this worked for me ( linux arm64 ) :
git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
cd tensorflow_src
git checkout v2.10.0
# https://github.com/tensorflow/tensorflow/issues/56125
sed -i 's/common\.c/common\.cc/' ./tensorflow/lite/c/CMakeLists.txt
cd ..
mkdir tflite_build
cd tflite_build
cmake ../tensorflow_src/tensorflow/lite/c
cmake --build . -j 1
Then
export CGO_CFLAGS=-I$HOME/src/tensorflow/tensorflow_src
export CGO_LDFLAGS=-L$HOME/src/tensorflow/tflite_build
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/src/tensorflow/tflite_build
git clone https://github.com/mattn/go-tflite.git
cd go-tflite/_example/label_image
go run main.go
85: peacock: 0.976471
I was able to make Tensorflow 2.14.0 work on macOS with these steps, and it includes fix for "common.c" issue so that step can be skipped