doutao6653 2018-12-20 18:13
浏览 225

在树莓派上构建libtensorflow.so时出错

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.

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

Goal: Build libtensorflow.so for tensorflow r1.11.0 or r1.12.0

Any help is appreciated.

  • 写回答

1条回答 默认 最新

  • doujiena0025 2019-01-15 16:09
    关注
    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>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值