我怎样才能只构建 TensorFlow lite 而不是从源代码构建所有 TensorFlow?
How can I build only TensorFlow lite and not all TensorFlow from source?
我正在尝试将 edgetpu USB 加速器与 Intel ATOM 单板计算机和 C++ API 一起用于实时推理。
C++ API for edgetpu 基于 TensorFlow lite C++ API。我需要包含 tensorflow/lite 目录中的头文件(例如 tensorflow/lite/interpreter.h)。
我的问题是我可以只使用 Lite 构建 tensorflow(不能使用其他用于训练的操作)吗?如果可以,我该怎么做?
因为全部安装都需要很长时间。
假设您使用的是 Linux-based 系统,以下指令应该有效:
克隆存储库,然后签出稳定版本(当前 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
现在,您需要 link 在您的项目中构建库,将其添加到您的 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 存储库中的独立构建。我有 tensorflow lite project 可以帮助你,你需要针对各自的平台类型交叉编译它。
我正在尝试将 edgetpu USB 加速器与 Intel ATOM 单板计算机和 C++ API 一起用于实时推理。
C++ API for edgetpu 基于 TensorFlow lite C++ API。我需要包含 tensorflow/lite 目录中的头文件(例如 tensorflow/lite/interpreter.h)。
我的问题是我可以只使用 Lite 构建 tensorflow(不能使用其他用于训练的操作)吗?如果可以,我该怎么做?
因为全部安装都需要很长时间。
假设您使用的是 Linux-based 系统,以下指令应该有效:
克隆存储库,然后签出稳定版本(当前
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
现在,您需要 link 在您的项目中构建库,将其添加到您的 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 存储库中的独立构建。我有 tensorflow lite project 可以帮助你,你需要针对各自的平台类型交叉编译它。