2

I'm brand new to Raspberry Pi and I'm not sure if the Pi Zero is sufficient for something I'm trying to do (I want to use Pi Zero since cost is my main concern). I've been searching through the forums, Stack, and other websites online, but I can't seem to find a definitive answer, which is what brings me to ask here!

Basically, I have a bird feeder that I would like to monitor using Raspberry Pi. What I want it to do is take 1 photo every 1 minute (or couple minutes), analyze that photo using a Tensorflow model, and if it detects a bird, an LED should light up. If it detects a squirrel or any other animal, nothing should happen (since the Tensorflow model doesn't detect squirrels anyway).

I don't want to do the image analysis on the cloud or on another place - I want to do it right on the Raspberry Pi Zero without needing any additional hardware or connections (except maybe an SD card for additional storage).

I have a Tensorflow model (200MB size file) for detecting a bird in an image. I know these microcomputers use Tensorflow Lite, so I'll be sure to use Tensorflow Lite.

I know that this is a simple and easy problem using one of the larger Raspberry Pi models, but cost is my main issue (because I plan to purchase many Pi's for similar uses). I saw that the Raspberry Pi Zero is $5, which is why I was thinking of using it! I haven't purchased any, so I'd like to know if it's capable of accomplishing this task.

I've read a bunch of things online about using the Zero for tasks similar to this (such as face detection), but I don't think any examples used Tensorflow Lite, so I don't know if the Zero can handle this goal.


So all-in-all, I just want to know if a Pi Zero would be able to run a Tensorflow Lite model on-board without additional hardware (except SD card and camera) and without the cloud. I don't need any fancy features, and I'm not looking to do something resource-intensive with it (such as analyzing videos or real-time computer vision); it just needs to be able to take a photo, process/analyze that 1 photo (using Tensorflow model... like YOLO) within 1 minute (or couple... performance isn't important), and light up an LED.

I'd greatly appreciate it if someone who actually has a Pi Zero tried it out, so that answers are not just speculations; I would, but I don't have one, unfortunately.

13
  • TBH I've never tried but you may like to have a read through pyimagesearch.com/2018/06/18/… that covers facial recognition on the Pi - it may give you some ideas.
    – user115418
    May 28 '20 at 19:52
  • @Andyroo Hi, thanks for the comment! I'll take a look through it, but just from scanning the article, it seems to be for real time analyzing a video stream. I'm looking to only classify pictures (like once per minute), which should take significantly less resources. So I'm wondering if it would take low enough resources that the Pi Zero can handle it.
    – F16Falcon
    May 28 '20 at 20:08
  • The pi can easily do that in terms of RAM and CPU power
    – Sim Son
    May 30 '20 at 9:25
  • @SimSon Hi Sim Son, I appreciate your comment. So I'm assuming this means my tensorflow models would work for my projects! Would you mind writing it as an answer? It answers my question so I'd like to +1 and mark as best! :)
    – F16Falcon
    May 30 '20 at 12:46
  • 1
    @Sim Son Hmm, maybe I don't even need Tensorflow in that case. Do you know of any libraries/tools that'll allow me to do custom object detection to detect things such as animals, people, cars, etc. without having to use Tensorflow on the RPiZ? Facial recognition libraries can help with people detection, but I'm interested in using custom models for custom objects (like animals) that I'll train on my computer and use my Pi to use that model to analyze single photos.
    – F16Falcon
    May 30 '20 at 22:33
1

I will try to explain things here. Pi zero has ARM V6. The binaries will work very badly with this CPU. The RAM is 512. With a lots of software and modification you may run it but the performance will be very very slow.ML is best to be practices in PI4.

2
  • Hi Sohan Arafat, Thanks for your answer. I'm not particularly concerned with performance. After all, all I need to do is scan a single image (not a video) within like 1 minute (so yeah, it can be slow) using my Tensorflow model to detect if there is a bird or person or car or other object. It's fine if it works badly (as in slow), as long as it's possible. Have you tried this out? I've seen some videos/articles that claim to use Tensorflow using the Zero, but others say you can't run Tensorflow on it. Not quite sure which to believe!
    – F16Falcon
    May 31 '20 at 13:21
  • @F16Falcon Slow processing is not the main concern. Te problem is with compatibility. And I was not talking about a video piece . Scanning an image with ML is a very complicating process. But I said you can do it. If you have a Pi0 you should try it first. May 31 '20 at 20:06
0

Yes it can - I tested this example on Pi3 A+ - once opencv/model is loaded image recognition takes ~1.5 seconds. I expect Pi Zero to do the same in ~10-20 seconds.

On pi zero you might have a problem with installing opencv - you want to use pip install opencv-contrib-python-headless not sure if the NN stuff might be in the contrib part. But expect it to compile opencv wheels, that takes forever (a full day). And needs 1Gbyte of swap. Someone mentioned taking the sd card initialized on Zero and booting it on Pi4 and run the pip install on pi4. Which hopefully compiles zero binaries with the speed of pi4.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.