TensorFlow Raspberry Pi示例

时间:2016-11-17 13:29:04

标签: python makefile tensorflow raspberry-pi2

我真的不熟悉make。所以我不明白2个教程(“TensorFlow Makefile”和“TensorFlow Raspberry Pi例子”)中这些步骤的含义,以使我的笔记本电脑上的项目在raspberry pi 2上工作

TensorFlow Makefile:

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

TensorFlow Raspberry Pi示例:

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

据我所知,“TensorFlow Makefile”会将tensorflow源,lib转换为可执行文件。 “TensorFlow Raspberry Pi示例”意味着将项目转换为可执行文件,然后在your_project/gen/bin/your_project中运行文件

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

因此,如果我的笔记本电脑上有一个项目,并希望将我的项目加载到Pi 2(“TensorFlow Makefile”已经完成)。我只是将它复制到我的pi 2并执行:

make -f tensorflow/my_project/Makefile

然后运行:

tensorflow/my_project/gen/bin/my_project

这是如何让你的项目在raspberry pi 2上运行的,对吗?

1 个答案:

答案 0 :(得分:0)

这只适用于Makefiles,它可以选择从(可能)x86(_64?)架构笔记本电脑交叉编译到ARM架构Raspberry Pi。

但是你很幸运:Google在TensorFlow的Makefile中包含了在架构之间进行交叉编译的选项!

如果您查看line 123 of the Makefile,就会看到有关此问题的评论。

  

默认运行在我们正在编译的同一系统上。   如果您正在进行交叉编译,则应在命令行上覆盖TARGET,例如   make -f tensorflow/contrib/makefile/Makefile TARGET=ANDROID

所以,简单地让项目如此:

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

这将为RPi编译TensorFlow。

顺便说一句,如果可以的话,通过从git中提取源代码或通过USB将其传输到RPi并在那里构建,可以更容易地简单地在 RPi上编译TensorFlow