Construction of TensorFlow based on the source code for the Raspberry Pi device

This guide is constructed TensorFlow run Raspberry Pi embedded devices Raspbian 9.0 operating system. While these instructions may also apply to other series of Raspberry Pi device, but it is only tested and supported configuration for this article involved.

We recommend a way to build cross-compiler TensorFlow Raspbian package. Cross-compiler to build packages using different platforms. Construction of TensorFlow on Raspberry Pi device other words, we are not equipped with limited RAM and relatively slow processor, but the use of more robust host building.

Host Settings

Docker installation
to simplify dependency management, we use the Docker to create virtual Linux development environment. Docker by executing the following command to verify whether the installation: docker run -rm hello-world

TensorFlow download the source code
using Git clone TensorFlow:

1
2
git clone https: //github .com /tensorflow/tensorflow .git
cd tensorflow

The default is the master branch. You can also check out the release branch to be built:

1
git checkout branch_name  # r1.9, r1.10, etc.

Based on the source code construct

TensorFlow cross compiler source code, to construct a packet based Python pip ARMv7 NEON instruction, the instruction is suitable for Raspberry Pi 2 and 3 devices. Docker container to start build script to compile. Based Python code Python 2.7 and 3 as follows:
Python 3

1
2
3
4
5
6
7
8
9
CI_DOCKER_EXTRA_PARAMS= "-e CI_BUILD_PYTHON=python3 -e CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.4" \
     tensorflow /tools/ci_build/ci_build .sh PI-PYTHON3 \
     tensorflow /tools/ci_build/pi/build_raspberry_pi .sh
 
 
Python 2.7
 
tensorflow /tools/ci_build/ci_build .sh PI \
     tensorflow /tools/ci_build/pi/build_raspberry_pi .sh

To construct the device supports all Raspberry Pi package, as follows:

1
2
tensorflow /tools/ci_build/ci_build .sh PI \
     tensorflow /tools/ci_build/pi/build_raspberry_pi .sh PI_ONE

After the build is complete (about 30 minutes), a package file is created in the output-artifacts directory. Copy this file to Raspberry Pi and installed via pip:

1
pip install tensorflow-version-cp34-none-linux_armv7l.whl

via Google TensorFlow

 

Source: http://shumeipai.nxez.com/2018/10/24/building-tensorflow-for-raspberry-pi-devices-based-on-source-code.html

Guess you like

Origin www.cnblogs.com/mq0036/p/11129348.html