Machine learning is the topic on everyone’s lips. It’s easy to see why. It is the future of data manipulation and is already used in almost every modern business setting. But can it be combined with a Raspberry Pi? Is the Pi up to the task of sustaining a working neural network? With Google TensorFlow, it can!

Here’s how to install TensorFlow on a Raspberry Pi, with some examples of usage.

What Is TensorFlow?

Before diving into examples of how TensorFlow is used, it’s worth knowing what it actually is.

In short, TensorFlow is Google’s trainable neural network, which can perform many different tasks. By actively learning from a user-curated dataset, TensorFlow neural networks makes accurate predictions when given new data.

In this instance, TensorFlow provides an already trained neural network. All the user must do is input the correct data type, and TensorFlow will guess what the image contains. Even the basic implementation of TensorFlow is capable of classifying images into 1000 classes. It gets a surprising amount correct!

“An added bonus many pointed out is that, once installed, no internet access is required.”

Previous image recognition has always relied on a huge amount of processing time, or an internet connection. A Pi cannot always pass off information to the cloud, and has limited processing power. This is the solution, a self-contained offline object recognizer you can make at home. It’ll even tell you what it is looking at. Isn’t the future marvelous?

Google assembled a dataset with over 65,000 crowdsourced words. This open-source dataset trained the neural net to understand some words.

In this case, it added several possible wake words but still runs into a familiar machine learning problem: it takes a lot of data to train a neural network.

Unless you are willing to create a unique dataset with tens of thousands of entries, you are limited to what is freely available. This project shows the limitations of TensorFlow on the Pi in its current state. It is fully functional but pushes the Pi’s computational capabilities. As with all new technologies, this early implementation is a glimpse into the future of smart home devices.

The DeepPiCar is an excellent example of this kind of neural network in action. Alongside standard remote control this Raspberry Pi robot features something altogether cleverer. Trained on a dataset provided on the GitHub project page, the network learns to stay on a predetermined track.

This project is not for beginners. The hardware required can be found in almost any cheap robot kit. The software implementation takes some more in-depth knowledge. You should have a good grasp of machine learning before taking it on.

The sorting of fresh produce for different markets is a massive cost for smaller providers. Sorting cucumbers by size and quality is a task which until recently could only be performed by a human operator. Machine sorting was very difficult to achieve, and costly. TensorFlow solves this problem by categorizing cucumbers in real time via camera.

Using over 7000 images of cucumbers, Makoto trained a neural network to distinguish between different types. In operation, webcams capture images from three angles. The Pi classifies the images, before forwarding them to a Linux server for further classification. The result triggers a conveyor belt and servo system which sorts the cucumbers into boxes.

Ian Buckley started out with a degree in Music composition, before devoting his time to DIY tech and coding. He now works as a freelance journalist, performer and video producer living in Berlin, Germany. When he's not writing or on stage, he's tinkering with DIY electronics or code in the hope of becoming a mad scientist.