Getting Tensorflow 1.4 on RaspberryPi 3

There are two methods to install tensorflow on raspberry pi, installing form binary which is provided by ci.tensorflow.org (you can get all nighly builds for all platform) or building from source which is hard and takes lots of time and setup. Build usually fails multiple times unless you know exactly what you do.

I will explain, how I installed tensorflow 1.4 on raspberry pi3 from pre-compiled binary.

Install pip,

# For Python 2.7
sudo apt-get install python-pip python-dev

# For Python 3.4
sudo apt-get install python3-pip python3-dev

Tensorflow nightly build for pi3 in python3 is avalilable here

Choose the date of the build, copy the link for .whl file.tensorflow nightly for raspberry pi 3

Install tensorflow, for python 3.4 use pip3 and pip for python 2.7.

sudo pip3 install http://ci.tensorflow.org/view/Nightly/job/nightly-pi-python3/39/artifact/output-artifacts/tensorflow-1.4.0-cp34-none-any.whl

or download it if you need a backup and install the file

wget http://ci.tensorflow.org/view/Nightly/job/nightly-pi-python3/39/artifact/output-artifacts/tensorflow-1.4.0-cp34-none-any.whl

sudo pip3 install ./tensorflow-1.4.0-cp34-none-any.whl

Test the installation,

$ python3
>>> import tensorflow as tf

If it is installed correctly, no errors will be shown. If there are errors while running, try uninstalling and install another nighty build binary. The tensorflow speech detection can be now run on raspberry pi after copying the files to the pi. Use scp for copying over ssh.

scp pi@192.168.1.xxx:my_frozen_graph.py /tmp/my_frozen_graph.py
scp pi@192.168.1.xxx:conv_labels.txt /tmp/speech_commands_train/conv_labels.txt
scp pi@192.168.1.xxx:a5d485dc_nohash_0.wav /tmp/speech_dataset/left/a5d485dc_nohash_0.wav

Make sure to clone the tensorflow tree from github to raspberry pi before running the label_wav.py

git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow/examples/speech_commands

python tensorflow/examples/speech_commands/label_wav.py \
--graph=./my_frozen_graph.pb \
--labels=./conv_labels.txt \
--wav=./a5d485dc_nohash_0.wav

running tensorflow speech detection on raspberry pi 3

6 thoughts on “Getting Tensorflow 1.4 on RaspberryPi 3

  1. How much time it takes to infer a wav file using label_wav.py on raspberry pi 3? Somehow, for me, it is taking around 20-22 sec. I am inferring one of the training wav file only.

  2. Thanks for your explanation! However, I am having trouble downloading nightly, since my raspberry keeps telling me that the file above is not supported wheel on the platform.
    Do you have any idea how I should solve this? I perfectly ran your codes on my laptop, but have been stuck in here for a week with my raspberry.
    Thanks again!

      1. At first, I was using 3.5, so I reinstalled 3.4 but still got the same problem.
        I was using 3.6 in my laptop so I installed 3.6 in my raspberry and nothing changed still…
        So confused, but will try more options. Should you have any tips for me, it would be really grateful

        1. I assume the reason is, you are trying the install tensorflow 1.8. The default link to nightly is pointing to latest build. I tried this with tensorflow 1.4.

          sudo pip3 install http://ci.tensorflow.org/view/Nightly/job/nightly-pi-python3/39/artifact/output-artifacts/tensorflow-1.4.0-cp34-none-any.whl

          You can try installing older version of tensorflow in Jetkins page, use arrow button near find text box.

          http://ci.tensorflow.org/view/Nightly/job/nightly-pi-python3/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.