How can I build only TensorFlow lite and not all TensorFlow from source?

女生的网名这么多〃 提交于 2020-06-12 15:29:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!