Nguyen Khoi
Nguyen Khoi

Reputation: 75

TensorFlow Raspberry Pi Examples

I'm really not familiar with make. So I don't understand the meaning of those steps in 2 tutorials ("TensorFlow Makefile" and "TensorFlow Raspberry Pi Examples") to make my project on laptop work on raspberry pi 2

TensorFlow Makefile:

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile

TensorFlow Raspberry Pi Examples:

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/pi_examples

As far as i know,"TensorFlow Makefile" will convert the tensorflow source,lib to executable file. "TensorFlow Raspberry Pi Examples" means convert your project to executable file then run the file in your_project/gen/bin/your_project

tensorflow/contrib/pi_examples/label_image/gen/bin/label_image

Hence,if I have a project on my laptop and want to load my project into Pi 2 ("TensorFlow Makefile" is already done). I just copy it to my pi 2 and do :

make -f tensorflow/my_project/Makefile

then run :

tensorflow/my_project/gen/bin/my_project

This is how to make your project work on raspberry pi 2, right ?

Upvotes: 2

Views: 1440

Answers (1)

Jules
Jules

Reputation: 14520

This will only work for Makefiles which have the option to cross-compile from a (presumably) x86(_64?)-architecture laptop to an ARM-architecture Raspberry Pi.

You're in luck, though: Google's included options in TensorFlow's Makefile to cross-compile between architectures!

If you look at line 123 of the Makefile, you'll see a comment about this.

Default to running on the same system we're compiling on. You should override TARGET on the command line if you're cross-compiling, e.g. make -f tensorflow/contrib/makefile/Makefile TARGET=ANDROID

So, simply make the project like so:

$ make -f tensorflow/contrib/makefile/Makefile TARGET=PI

This will compile TensorFlow for the RPi.

Incidentally, if you can, it may be easier to simply compile TensorFlow on the RPi by either pulling the sources from git or transferring it onto the RPi via USB, and building there.

Upvotes: 0

Related Questions