AI can be DIY – a Raspberry Pi powered “seeing eye”
Tags: ai, machinelearning, opensource, raspberrypi
Published: 2017-11-14 13:41:20

---
title: "AI can be DIY – a Raspberry Pi powered “seeing eye”"
published: true
tags: Artificial Intellige,machine learning,Open Source,Raspberry Pi
canonical_url: https://innovativetechnology.jiscinvolve.org/wp/2017/09/16/ai-can-be-diy/
---

Scarcely a day goes by right now without&nbsp;a breathless newspaper headline about how artificial intelligence (AI) is going turn us all into superhumans, if it doesn’t end up replacing us first.&nbsp;But what do we really mean by&nbsp;AI, and what could we do with it? In this post&nbsp;I’ll take a look at the state of the art, and how you could build your own Do-It-Yourself “seeing eye” AI using a cheap&nbsp;[Raspberry Pi](https://www.raspberrypi.org/)&nbsp;computer&nbsp;and some free&nbsp;software from Google called [TensorFlow](http://www.tensorflow.org).

If you want to have a go at doing this yourself, I’m following a brilliant [step by step guide](https://planb.nicecupoftea.org/2016/11/11/a-speaking-camera-using-pi3-and-tensorflow/)&nbsp;produced by&nbsp;Libby Miller from BBC R&D. I should also note that this is possible because of Sam Abrahams, who got [TensorFlow working on the&nbsp;Raspberry Pi](https://github.com/samjabrahams/tensorflow-on-raspberry-pi), and also literally [wrote the book on TensorFlow](http://www.samabrahams.com/).

 ![](http://innovativetechnology.jiscinvolve.org/wp/files/2017/09/IMG_20170519_153804-300x225.jpg)

Raspberry Pi logo screen printed onto motherboard

AI right now is mainly focussed pattern recognition – in still and moving&nbsp;images, but also in sounds (recognising words and sentences) and text (this text is written in English). A good example would be the Raspberry Pi logo in the picture above. Even thought it’s a little blurred and we can’t see the whole thing, most people would recognise that&nbsp;the picture included some kind of berry. People who were familiar with the diminutive low cost computer would be able to identify that the picture included the Raspberry Pi logo almost instantly – and the circuit board background might help to jog their memory.

While we talk about “intelligence”, the truth is that this pattern recognition is pretty dumb. The intelligence, if there is any, is supplied by a human being adding some rules that tell the computer what patterns to look out for and what to do when it matches a pattern. So let’s try a little experiment – we’ll attach a camera and a speaker to our Raspberry Pi, teach it to recognise the objects that the camera sees, and tell us what it’s looking at. This is a very slow and clunky low tech version of the [OrCam](http://www.orcam.com/), a new invention helping blind and partially sighted people to live&nbsp;independently.

 ![Our Raspberry Pi powered "seeing eye" AI](http://innovativetechnology.jiscinvolve.org/wp/files/2017/09/Screen-Shot-2017-09-16-at-16.17.58-1024x478.png)

Our Raspberry Pi powered “seeing eye” AI

The&nbsp;Raspberry Pi uses&nbsp;very little electricity, so you can actually run it off a battery, although it’s not as portable or as sleek as&nbsp;the OrCam! And rather than a speaker, you could simply&nbsp;plug a pair of headphones in – but the speaker makes my demo video work better. I used a Raspberry Pi model 3 (Â£25) and an official Raspberry Pi camera (Â£29). If you’re wondering what the wires are for, this is my cheap and cheerful substitute for a shutter release button for the camera, using the Raspberry Pi’s General Purpose Input Output (GPIO) connector. GPIO makes it easy to connect all kinds of hardware and expansion boards to your Raspberry Pi.

So that’s the hardware – what about the software? That’s the real brains of our AI…

Google’s TensorFlow is an open source machine learning system.&nbsp;Machine learning is the technology that underpins most modern AI systems, and it’s responsible for the pattern&nbsp;recognition I was talking about just now. Google took the bold step of not just making TensorFlow freely available, but also giving everyone access to the source code of the software by making it “open source”. This means that developers all over the world can (and do) enhance it and share their changes.

The catch with machine learning is that you need to feed your AI lots of example data before&nbsp;it’s able to successfully carry out that pattern recognition I was talking about. Imagine that you are working with a self-driving car – before it can be reasonably sure what a cat running out in front of the car looks like, the AI will need&nbsp;training.&nbsp;You would typically do this by showing&nbsp;it lots of pictures of cats running out in front of cars, maybe gathered during your human driver assisted test runs. You’d also show it lots of pictures of other things that it might encounter which aren’t cats, and tell it which pictures are the ones with cats in. Under the hood, TensorFlow builds a “neural network” which is a crude simulation of the way that our own brains work.

So let’s give our Raspberry Pi and TensorFlow powered AI a spin – watch my video below:

<iframe width="625" height="352" src="https://www.youtube.com/embed/2kO8ScrqikM?feature=oembed" frameborder="0" allowfullscreen></iframe>

Now for a confession – I didn’t actually sit down for hours&nbsp;teaching it myself. Instead I used a ready-made TensorFlow model that Google have trained&nbsp;using [ImageNet](http://www.image-net.org/), a free database of over 14 million images. It would take a long time to build this model on the&nbsp;Raspberry Pi itself, because it isn’t very powerful. If you wanted to create a complex model of your own and don’t have access to a supercomputer, you can rent computers from the likes of Google, Microsoft and Amazon to do the work for you.

So&nbsp;now you’ve seen my&nbsp;“seeing eye” AI, what would you use TensorFlow for? Why not leave a comment and let me know…

&nbsp;