11 September 2018

How to Build DIY AI Projects Using Google TensorFlow and Raspberry Pi


tensorflow-raspi-ai

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 short, TensorFlow neural networks think.

Check our list of Tensorflow examples for more information.

How to Install TensorFlow

While understanding the subject of machine learning takes serious study, basic TensorFlow usage is easy to follow. Our Image Recognition with TensorFlow tutorial covers installing the library onto your Pi. It also covers testing it, and running the basic Inception image classification program.

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!

But what else can you do with TensorFlow on the Raspberry Pi?

Portable Image Recognition

We have covered how to make a smart webcam before, but this talking mobile image classifier takes it to a new level.

This detailed post outlines the hardware setup and custom software integrated with the Inception image classifier. The example code shows just how easy it is to integrate TensorFlow with a project (provided you are comfortable with the basics of the Python Programming language). The article goes into great detail about the process of image recognition. It is an excellent resource in general for anyone interested in the field.

One excellent element of this setup may not be initially clear:

“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?

TensorFlow Magic Mirror

Homemade smart (or “magic”) mirrors are about the coolest thing you can build. Requiring only a Pi and an old laptop screen along with basic DIY supplies, it’s a great beginner project. Alasdair Allan decided not to settle for the average smart mirror and built the TensorFlow magic mirror with voice recognition.

Unsatisfied with the cost of web-based speech recognition, Alasdair decided on TensorFlow as an offline alternative. Integrating TensorFlow’s pretrained voice recognition model into the already utilized AIY kit code adds custom wake words to the project.

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.

TensorFlow Autonomous RC Car

Given Google’s history with self-driving cars, it is no surprise that TensorFlow is well suited to autonomous driving.

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.

Cucumber Auto-Sorter

One of the best-known deployments of TensorFlow on the Pi, Makoto Koike’s cucumber sorter is a sign of things to come.

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.

The Start of Something Smart

We’ve seen Raspberry Pi’s used for everything, so it’s unsurprising that TensorFlow has arrived on it. The Pi struggles to keep up with the demands of machine learning, but it’s great for learning the basics.

Read the full article: How to Build DIY AI Projects Using Google TensorFlow and Raspberry Pi


Read Full Article

No comments:

Post a Comment