如何仅从源代码构建

如何仅从源代码构建

本文介绍了如何仅从源代码构建 TensorFlow lite 而不是所有 TensorFlow?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to use edgetpu USB accelerator with Intel ATOM single board computer and C++ API for real-time inference.

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

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).

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

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.

推荐答案

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

Assuming that you are using a Linux-based system, the following instruction should work:

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

git clone https://github.com/tensorflow/tensorflow
git checkout r1.14
cd tensorflow

  • 下载依赖项:

  • Download dependencies:

    ./tensorflow/lite/tools/make/download_dependencies.sh
    

  • 构建它(默认情况下它构建一个 Linux 库,其他平台也有其他选项):

  • 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
    

  • 现在,您需要在您的项目中链接构建的库,并将其添加到您的 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
    

  • 这篇关于如何仅从源代码构建 TensorFlow lite 而不是所有 TensorFlow?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    07-23 07:32