在树莓派上构建libtensorflow.so时出错 [英] Error while building libtensorflow.so on raspberry pi

查看:144
本文介绍了在树莓派上构建libtensorflow.so时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题陈述::我想使用Golang TensorFlow在Raspberry PI 3中运行我的模型.要使用TensorFlow go,我需要拥有 libtensorflow.so libtensorflow_framework.so c ++共享库.

Problem Statement: I would like to use Golang TensorFlow to run my model in Raspberry PI 3. To use TensorFlow go, I need to have libtensorflow.so and libtensorflow_framework.so c++ shared library.

我试图使用 bazel v0.20.0 从源代码进行构建,但最终遇到了问题并最终出错了.

I was trying to build from source using bazel v0.20.0 but facing a problem and its erroring out at last.

目标:为张量流r1.11.0或r1.12.0构建libtensorflow.so

感谢您的帮助.

推荐答案

I found solution:
Couple of things to take care.

***For Tensorflow < v1.5***
Follow instruction here: https://blog.meinside.pe.kr/TensorFlow-and-Go-on-Raspberry-Pi/

***For Tensorflow v1.11.0 - v1.12.0***
Install bazel:
1. Download bazel from link: https://github.com/bazelbuild/bazel/releases
for specific architecture.
2. Install bazel
chmod +x bazel-<version>-installer-linux-<arch>.sh
./bazel-<version>-installer-linux-<arch>.sh --user
Install protobuf:
1. Build/Install protobuf from source.
https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
Build Tensorflow:
1. Git clone
git clone https://github.com/tensorflow/tensorflow.git
2. Check and remove build from specific tensorflow version
go to: tensorflow/tensorflow/tools/ci_build/install/*_toolchain.sh [specific to your linux type and arch]
remove the bazel build and installation like as follows
look for the line: **rm -rf /usr/local/bin/bazel** and remove
and remove **bazel** from line **apt-get install -y ...**

then run 
CI_DOCKER_EXTRA_PARAMS="-e CI_BUILD_PYTHON=python3 -e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.6" tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/pi/build_raspberry_pi.sh

or 

tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/pi/build_raspberry_pi.sh 

or 

tensorflow/tools/ci_build/ci_build.sh PI tensorflow/tools/ci_build/pi/build_raspberry_pi.sh PI_ONE

Output:
Output can be found here:
output-artifacts
output-artifacts/tensorflow-1.12.0-cp27-none-linux_armv7l.whl
output-artifacts/libtensorflow_framework.so
output-artifacts/benchmark_model
output-artifacts/libtensorflow.so

Dependency Versions:
Tensorflow       Bazel       protoc
<1.5             0.5.0       3.0 <any>
1.11.0-1.12.0    0.15.2      3.x <any>
>1.12.0          new vers    <any>

这篇关于在树莓派上构建libtensorflow.so时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆