【问题标题】:How can I build only TensorFlow lite and not all TensorFlow from source?如何仅从源代码构建 TensorFlow lite 而不是所有 TensorFlow?
【发布时间】:2019-07-22 18:41:25
【问题描述】:

我正在尝试将 edgetpu USB 加速器与 Intel ATOM 单板计算机和 C++ API 一起使用以进行实时推理。

edgetpu 的 C++ API 基于 TensorFlow lite C++ API。我需要包含来自 tensorflow/lite 目录的头文件(例如 tensorflow/lite/interpreter.h)。

我的问题是我可以仅使用 Lite 构建 tensorflow(而不是用于训练的其他操作)吗?如果是,我该怎么做?

因为安装所有东西都需要很长时间。

【问题讨论】:

    标签: c++ tensorflow tensorflow-lite


    【解决方案1】:

    假设您使用的是基于 Linux 的系统,以下说明应该可以工作:

    • 克隆存储库,然后签出到稳定版本(当前为r1.14):

      git clone https://github.com/tensorflow/tensorflow
      git checkout r1.14
      cd tensorflow
      
    • 下载依赖:

      ./tensorflow/lite/tools/make/download_dependencies.sh
      
    • 构建它(默认构建一个 Linux 库,其他平台也有其他选项):

      make -f ./tensorflow/lite/tools/make/Makefile
      
    • 现在,您需要在项目中链接已构建的库,将其添加到您的 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
      

    【讨论】:

      【解决方案2】:

      您需要一个不属于 tensorflow 存储库的独立构建。我有 tensorflow lite project 可以帮助你,你需要针对各自的平台类型交叉编译它。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多