Giter VIP home page Giter VIP logo

tensorflow-on-arm's Introduction

Tensorflow-on-arm

Inspired by tensorflow-on-raspberry-pi. Tool to compile tensorflow for ARM.

Dependencies

apt-get install openjdk-8-jdk automake autoconf
apt-get install curl zip unzip libtool swig libpng-dev zlib1g-dev pkg-config git g++ wget xz-utils

# For python2.7
apt-get install python-numpy python-dev python-pip python-mock

# If using a virtual environment, omit the --user argument
pip install -U --user keras_applications==1.0.8 --no-deps
pip install -U --user keras_preprocessing==1.1.0 --no-deps

# For python3
apt-get install python3-numpy python3-dev python3-pip python3-mock

# If using a virtual environment, omit the --user argument
pip3 install -U --user keras_applications==1.0.8 --no-deps
pip3 install -U --user keras_preprocessing==1.1.0 --no-deps
pip3 install portpicker

TensorFlow on Raspberry Pi

It's officially supported!

Python wheels for TensorFlow are officially supported. This repository also maintains up-to-date TensorFlow wheels for Raspberry Pi.

Installation

Check out the official TensorFlow website for more information.

Cross-compilation

Make you sure add the ARM architecture to your package manager, see how to add it in Debian flavors:

dpkg --add-architecture armhf
echo "deb [arch=armhf] http://httpredir.debian.org/debian/ buster main contrib non-free" >> /etc/apt/sources.list

If you want compile Python support:

# For python2.7
apt-get install libpython-all-dev:armhf

# For python3
apt-get install libpython3-all-dev:armhf

Using Docker

Python 3.7

cd build_tensorflow/
docker build -t tf-arm -f Dockerfile .
docker run -it -v /tmp/tensorflow_pkg/:/tmp/tensorflow_pkg/ --env TF_PYTHON_VERSION=3.7 tf-arm ./build_tensorflow.sh configs/<conf-name> # rpi.conf, rk3399.conf ...

Python 3.8

cd build_tensorflow/
docker build -t tf-arm -f Dockerfile.bullseye .
docker run -it -v /tmp/tensorflow_pkg/:/tmp/tensorflow_pkg/ --env TF_PYTHON_VERSION=3.8 tf-arm ./build_tensorflow.sh configs/<conf-name> # rpi.conf, rk3399.conf ...

Edit tweaks like Bazel resources, board model, and others.

See configuration file examples in: build_tensorflow/configs/

Finally, compile TensorFlow.

cd build_tensorflow/
chmod +x build_tensorflow.sh
TF_PYTHON_VERSION=3.5 ./build_tensorflow.sh <path-of-config> [noclean]
# The optional [noclean] argument omits 'bazel clean' before building for debugging purposes.
# If no output errors, the pip package will be in the directory: /tmp/tensorflow_pkg/

tensorflow-on-arm's People

Contributors

lhelontra avatar droidicus avatar adrianghc avatar clemensvonschwerin avatar mattn avatar photoszzt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.