Computer Visioning with a Raspberry Pi

Curious to see whether or not a raspberry pi would be able to handle TensorFlow, I tried it on the newest Raspberry Pi 4 B.

Anna Seo
Anna Seo
Dec 6, 2019 · 4 min read
A photo of a raspberry pi 4 B being put together
A photo of a raspberry pi 4 B being put together
Assembling the Raspberry PiCamera Cana Kit

The Computer Visioning (CV) industry is about teaching computers to interpret images at a level close to the way humans see and process images. For example, a computer can be taught to recognize signs of melanoma by labeling the indicators of skin cancer in a large number of photos. Those photos are run through a deep learning neural network. It can also do more simple tasks like recognize vehicle models such as a Honda Civic.

Google released a very accessible computer visioning system called TensorFlow and there are pre-taught systems available too. I stumbled upon this technology while researching people/footfall counting mechanisms for my startup and was amazed that Google provided this technology for free. I needed to train the device with Object Detection specifically so I loaded one of the pre-trained systems onto a Raspberry Pi 4 to test it out.

The pre-trained quantized model I used was the SSD MobileNet v2 Lite which is able to identify ninety classes of objects ranging from bananas, bottles, cats, and of course — people.

Tensor Flow is known to be quite slow on a laptop with a decent processor so I wasn’t really sure how it would work out with the Raspberry Pi. I was hoping that since the Raspberry Pi would be dedicated to running TensorFlow that it would be able to handle the load.

The process of creating the directories and loading the files took roughly a week and it wasn’t the smoothest process. Downloading openCV took awhile but I thought that was the easiest way to go about it. The picamera image quality is not too bad, I would say it’s similar to the iPhone 4 camera quality.

So let’s take a look at some of the pictures I took running TensorFlow:

TensorFlow Object Detection: person and cell phone

This is an image I took the first day that I was able to get it to run. It had crashed 15+ times prior to this day and I was getting very frustrated. As you can see in the image, the device detected me as a person and my iPhone as a cell phone.

TensorFlow detecting: person, cell phone, and bottle

In the corner of this image you can see my Raspberry Pi all set up with the camera and all. I will say that it has been extremely difficult to find a case that allows you to attach both the camera and a cooling fine. I can use one or the other and it would be great if I could use the fan while running TensorFlow because it gets hot.

TensorFlow detecting: chairs and table

I tried out the raspberry pi at the office to test out different distances and see how TensorFlow handles it. It actually did a really good job detected objects from a distance. The table there is labeled as “dining table” because the pre-trained library possibly taught it to recognize all tables that way. Who’s to say that’s not a dining table though?

In conclusion, the Raspberry Pi 4 B was fully capable of running Object Detection. This is pretty impressive considering that it is priced at around $50 US dollars. If you are interested in trying this out yourself I would recommend using one to get started. There are so many instructions that teach you step by step how to load it all on so don’t be discouraged!

I actually do not come from a Technology background and am pursuing a degree in Biology. So if I can do it, you can too!

Data Driven Investor

from confusion to clarity, not insanity

Anna Seo

Written by

Anna Seo

I like discussions about technology and productivity. Here to put in my two cents.

Data Driven Investor

from confusion to clarity, not insanity

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade