c++ - 如何仅从源代码构建 TensorFlow lite 而不是所有 TensorFlow?

标签 c++ tensorflow tensorflow-lite

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

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

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

因为安装所有内容都需要很长时间。

最佳答案

假设您使用的是基于 Linux 的系统,以下指令应该有效:

  • 克隆存储库,然后 check out 稳定版本(当前为 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
    

关于c++ - 如何仅从源代码构建 TensorFlow lite 而不是所有 TensorFlow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57151987/

相关文章:

c# - IDirect3DTexture9::设置数据?

c++ - Lua使用C++向用户数据添加实例字段

python - 预期 TensorFlow 计算,发现内在

tensorflow - 我应该如何在 TensorFlow SavedModel 中存储元数据?

python - 在为 Android 应用程序制作 Tensorflow lite 模型以便显示输出时,我需要做些什么特别的事情吗?

tensorflow - Google Meet 背景模糊

c++ - 通过在基类中对其进行虚拟调用来访问派生类中的函数

tensorflow - Keras 连接类型错误 : __init__() got multiple values for argument 'axis'

python - 如何从 tflite 模型中提取元数据

c++ - 初始化一个 constexpr std::array of pairs