New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tensorflow on Raspberry Pi #254
Comments
We have not tried -- if you (or someone else) gives it a shot, let us know! |
Quick notes from a quick look...
Anyone get any further? |
Thanks @danbri for summarizing it. I'm currently trying different things but there seems to be serious issues with It's great seeing several developers interested on the Pi and although the hardware has constrained resources, the interest seems relevant. Hope Google reacts here. |
Nearby w.r.t. bazel, #326 |
bazelbuild/bazel#606 is looking more promising than last week... |
Some progress at #445. |
On the Bazel build part, http://cudamusing.blogspot.com.au/2015/11/building-tensorflow-for-jetson-tk1.html has instructions for an Arm32 build that may work on the Pi. |
Would love to see this too. Is it possible to just run TensorFlow compiled things on Raspberry Pi 2? |
Hi @nlothian, I follow this Jetson build step, use the whl file to install on RPi, but Tensorflow will include CUDA lib so file. So, it is not work. |
👍 |
@philipz I meant those instructions maybe helpful for getting Bazel building on the Pi as a necessary step towards getting TensorFlow working. If you got past that point it maybe worth looking at #445 where the specific problems around that were being tracked. You shouldn't be linking against CUDA for a Pi build! |
Just to spread some work that's been done in #445, we've managed to get TensorFlow compiled and running on the Raspberry Pi running Raspbian (although there hasn't been extensive testing yet). I've posted an unofficial pre-built Python wheel as well as step-by-step instructions on building from source yourself here. |
Thanks! I can confirm that it works with Ubuntu MATE on a Pi 3. |
I'm also successfully running @samjabrahams 's build on a Pi 3 (Linux raspberrypi 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux). |
Since #445 is now closed, I'm going to post progress and updates for running TensorFlow on Raspberry Pi here. I did some very basic benchmarking on the Inception-v3 model to explore whether the build is working properly. Interestingly, the Pi appears to have similar performance to a MacBook Pro when it comes to using a compiled C++ model, but much worse when using the Python version (granted, the C++ version also runs slower on the Mac, which raises a separate set of questions). I haven't gotten a good look at how Python binds to C++ in the code, but I'll do my best to figure out what's going on. My hope is that there is something screwy on the Pi that can be fixed which would lead to an order-of-magnitude time increase. I don't have much experience with C++ and its compile settings, so any ideas would be much appreciated! @petewarden - you mentioned here that you thought some slowdown could be due to the compiler not using NEON options. Do you think that's worth exploring here? @danbri - Could you send over the pixel dimensions of the pictures captured and used by your Raspberry Pi camera? I want to try testing images around that size to see if I end up with similar run-times |
All I had time to try so far was default output of raspiutil via the Python wrapper code. I started trying to build the C++ but didn't finish yet. For realtime camera access (staying within python) I believe http://picamera.readthedocs.org/en/latest/api_camera.html would be the way to go. The camera needs some warmup time to judge light balance, I read. And I didn't break down the python timings yet either into setup vs inference. Anyway: tensorflow/tensorflow/models/image/imagenet $ time raspistill --timeout 3 --nopreview -o ~/Desktop/headless.jpg real 0m0.765s time python classify_image.py --model_dir $HOME/imagenet/ --image_file ~/Desktop/headless.jpg --num_top_predictions 5 2>/dev/null real 0m33.291s file ~/Desktop/headless.jpg FWIW here's the picture http://imgur.com/UbsYZYC (upside down and truncated salt/pepperpots, so 'hourglass' was close ;) I'm also curious about the Python wrapper being slower than plain C++ since I thought Python offloaded all TF's heavy lifting to compiled code anyway. Is it possible it's running a different build of the TF core in one case? |
Thanks @danbri- I'm definitely going to take a closer look at the Python and C++ Inception code to see if there are any obvious differences in implementation between the two. I ran your image through my RPi directly in Raspbian and got the same results as I did with smaller images. My gut tells me that the Pi can do better that the performance we're getting, but I'm not sure if I should be looking at compiler options first or dive into the code first. I also checked out memory usage to cover more bases- doesn't appear to be an issue. |
Just to share the Python vs C++ links for others: |
@samjabrahams ... sorry I've not had time to try your new binaries yet. Have you had any more insights into the speed issue? |
@danbri - Not much yet: I've been low on time myself as well. My current goal is to get Bazel 2 running on a RPi, then put out new binaries for the 0.8 release once the candidate has gone gold. Afterward, hopefully I'll have some time to dig deeper into which operations are causing headaches on the Pi. |
Hi,
I do have "libstdc++.so.6" and "libstdc++.so.6.0.19" in /usr/lib/arm-linux-gnueabihf/ and I have gcc4.8 installed. Any advice is appreciated. |
thanks. I tried it but didn't help. Same error. |
I can confirm that @samjabrahams instructions for the RPi install also works for an Odroid Xu4 running Ubuntu 14.04, and while it did require building from source, it only took an hour or two to do so. |
@austinsteamboat how is the speed? e.g. running https://github.com/tensorflow/tensorflow/blob/master/tensorflow/models/image/imagenet/classify_image.py |
@danbri - I ran that test case on the Odroid and my laptop, there was no noticeable difference in evaluation time, definitely same order of magnitude. Looking at resource draw, it takes 4 cores at peak and ~500 MB of RAM when evaluating that imagenet model. I'm building custom classifiers one basic perceptron type model and a CNN and I can say the odroid runs 5x slower with the perceptron case (which is still plenty fast actually) and the CNN actually runs at about the same rate on both machines (really slow). When the CNN does run on the Odroid it eats between 4 and 7 of the 8 available cores and consumes ~1.9 GB of the 2 GB of RAM. I still have the swap partition turned on from the install and from what I've seen that's probably a good thing to have when running big CNNs like that. All in all pleasantly surprised by the performance so far. |
@austinsteamboat Thanks for the info! I just finished putting the 0.8.0 pip release out for the Raspberry Pi, so I'm hoping to have a few spare minutes over the next few weeks to check out some of the speed issues. From your info, it sounds like the problem could be at the operating system level, as Raspbian is still a 32-bit OS. The Odroid is certainly a more powerful machine than the Pi, but if the ImageNet model only takes 4 cores on both, I don't see the Pi lagging behind that badly. Hopefully I (or someone) can find something a bit more conclusive and precise for this. |
I confirm that with @samjabrahams whl I can get the "panda" and "uniform" result in 15s(use python example. not sure the cpp example). Thanks a lot! building tensorflow and bazel on raspberry is not a easy job......I tried but blocked at the javac report out of memory(I already change the swap file to 2GB but I found the javac even does not consider any swap space).
|
@samjabrahams perhaps this situation merits a new dedicated bug report, as it is a very specific matter? |
HI, would you like to make version10 of tensorflow on Pi? Because i want to try object recognition.Thanks. |
Hi @puchiko939393, I'm planning on building wheels for TensorFlow 0.10 as soon as it's officially released. There is only a release candidate at this time (0.10RC0), so I'm holding off until then. Feel free to use the guide to build it yourself if you simply can't wait! |
https://www.oreilly.com/learning/how-to-build-a-robot-that-sees-with-100-and-tensorflow?twitter=@bigdata also reports success with TF on Pi, seemed worth passing along here. |
Looks like https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile wasn't shared here. Non-bazel, makefile-based compilation; there's a "Raspberry Pi" section in the readme, plus https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/pi_examples from @petewarden and @vrv has some nice examples. Main drawback seems to be lack of language bindings (esp. python). (and no GPU, but that's pretty much a given for Pi anyway) edit:
|
Hi, Can I install TensorFlow on the Pi zero. I tried "sudo pip2 install tensorflow-0.9.0-cp27-none-linux_armv7l.whl" but it returned I haven't try from Docker image yet. is it possible ? thank you and regards, |
Time for a benchmark update- I posted the latest Inception-v3 benchmarks for version 0.11.0 here, and I'll update them again once 0.12.0 is official. Highlights:
I'm still compiling the Python 3 binaries for 0.11.0, and I need to update the instructions to make sure they work on a fresh copy of Raspbian. Hopefully get all that done by the end of the weekend. |
Not strictly related but new optimized cpu and gpu ARM kernels could be available. See ARM-software/ComputeLibrary#7 |
Dear samjabrahams Kind regards, P. |
@pczekalski - I'm moving your question to my repo in issue 90, as this thread probably isn't the right place to discuss non-RPi TensorFlow. |
Closing since Raspberry Pi binaries exist. |
@samjabrahams what are your plans w.r.t. the pi binaries? is the build process any easier than last year? |
@danbri - The process is a little smoother than it was at the end of last year, but it's still pretty much the same (in terms of needing to compile on-device). We don't need to compile I haven't had the time to put much effort into trying out cross-compilation options, unfortunately. In addition, I'm starting a new job which means that I'll need to talk to HR about continuing my efforts (I'm optimistic, but I don't make any assumptions). On a brighter note, I'm excited to try out these MobileNets on-device! |
Fixed bug test failed on parser_trainer_test
This is, reply to @samjabrahams comment on Mar 17, 2016. Have you guys tested if the python and c++ versions have similar performance. When I ran object detection model using python, I can clearly see only one core being used and it takes 6 seconds to process 1 image(640x480 res). I tried configuring the intra_ops config parameter, but no luck. I think by default tensorflow uses all cpu cores. I am not sure if I am the only one facing performance issues.. |
My experience was similar - Python was painfully slow
…On 8 Aug 2017 11:12 pm, "Kranthi" ***@***.***> wrote:
@danbri <https://github.com/danbri> @samjabrahams
<https://github.com/samjabrahams>
This is reply to @samjabrahams <https://github.com/samjabrahams> comment
on Mar 17, 2016. Have you guys tested if the python and c++ versions have
similar performance. When I ran object detection model using python, I can
clearly see only one core being used and it takes 6 seconds to process 1
image(640x480 res). I tried configuring the intra_ops config parameter, but
no luck. I think by default tensorflow uses all cpu cores. I am not sure if
I am the only one facing performance issues..
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#254 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKZGVAOvcaBmv2UIpysKjR2CJqXKagtks5sWN02gaJpZM4Gjqny>
.
|
@danbri . thanks for the reply. I hope they fix it in official release.. |
download the bazel binary for armv7l(pi 3) with this link below |
whatt about Mali 400 and more and tensorflow |
Add include of ADT/SmallVector.h. Fixes #254. PiperOrigin-RevId: 281721705 Change-Id: I59bfc916fc243973d6b4b556b34e22f17db5c7a7
Hi,
Is it possible to install Tensorflow on a Raspberry Pi? OS Ubuntu Mate, Python2.7
The text was updated successfully, but these errors were encountered: