问题
I am trying to use edgetpu USB accelerator with Intel ATOM single board computer and C++ API for real-time inference.
C++ API for edgetpu is based on TensorFlow lite C++ API. I need to include header files from tensorflow/lite directory (e.g. tensorflow/lite/interpreter.h).
My question is can I build tensorflow only with Lite (not other operations used for training )? if yes, how can I do it?
Because installing everything will take long time.
回答1:
Assuming that you are using a Linux-based system, the following instruction should work:
Clone the repository, then checkout to the stable release (currently
r1.14
):git clone https://github.com/tensorflow/tensorflow git checkout r1.14 cd tensorflow
Download dependencies:
./tensorflow/lite/tools/make/download_dependencies.sh
Build it (by default it builds a Linux library, there are other options as well for other platforms):
make -f ./tensorflow/lite/tools/make/Makefile
Now, you'll need to link the built library in your project, add this to your makefile:
TENSORFLOW_PATH = path/to/tensorflow/ TFLITE_MAKE_PATH = $(TENSORFLOW_PATH)/tensorflow/lite/tools/make CLAGS += \ -L$(TFLITE_MAKE_PATH)/gen/linux_x86_64/obj \ -L$(TFLITE_MAKE_PATH)/gen/linux_x86_64/lib/ \ -ltensorflow-lite -ldl
来源:https://stackoverflow.com/questions/57151987/how-can-i-build-only-tensorflow-lite-and-not-all-tensorflow-from-source