TREND
Artificial Intelligence: we tested Google's DIY kits
Google has released the first Kits for the development of interactive prototypes that embed Artificial Intelligence in their functions. We tested the innovative Vision Kit and tell you our impressions.
2018 was the year in which Artificial Intelligence was definitively cleared as a current-use technology in many everyday devices.
In recent years the progress recorded in the machine learning sector has profoundly influenced the development of big data management technologies, which are at the basis of web search systems like Google or content distribution on social networks like Facebook.
Neural Networks — initially used as more elegant computational architectures, alternatives to the traditional model fitting paradigms typical of traditional statistical algorithms — have gradually reached high performance, unimaginable until a few years before, and obtained important results in fields such as artificial vision, going as far as matching, if not exceeding, the performance of the human visual cortex in many applications.
While research in the field of machine learning and Neural Networks continues intensively in academic environments and in the laboratories of the major players that dominate the high-tech market, the first now-consolidated results in the field of Deep Learning, based on architectures such as Dense Neural Networks and Convolutional Neural Networks, are starting to be available in open source logic and free to all, fostering that process of democratisation of technology that the Hacker movements of the 1980s–1990s and the more recent Maker movements have accustomed us to, revealing its benefits in terms of cultural and social progress.
In the autumn of 2015 Google released under Apache 2.0 Open Source license the TensorFlow platform, a set of second-generation libraries for the development of applications based on neural networks.
The platform had initially been created for Google’s internal use, to support the development projects of the systems behind most of the Californian giant’s services, such as: the search engine, the voice-recognition interface, Google Photos and Gmail.
Currently, TensorFlow represents the state of the art of tools of this kind, and since its release the companies and organisations that have adopted it have been ever more numerous.
But what does a modern Artificial Intelligence application look like, and what are Neural Networks?
Conceptually it is rather simple: it is a software system that simulates the structure of a network of brain cells — neurons.
If in the brain of higher animals information propagates from sense organs through the network of neurons in the form of an electrical signal, in software the information consists of numbers that propagate through simple weighted-arithmetic-sum operations across a virtual network of processing nodes that perform very simple operations.
To each logical link between one virtual neuron and another is associated a coefficient, called weight. In the transfer between one neuron and another, the numerical information is multiplied by the weight associated with the link. When the network is implemented — that is, the software representing the network model is written — the coefficients, or weights, are randomly valued.
Subsequently the network is subjected to a learning process, during which, by means of mathematical formulas and sometimes complex algorithms of statistical derivation, the weights are iteratively modified until the network begins to classify data acceptably and with sufficient precision.
Writing from scratch the software that models the structure of a neural network suitable for handling real problems and the related operating algorithms is a very complex job.
TensorFlow facilitates this work by providing, as a sort of LEGO-like bricks, all the necessary pieces, sparing the programmer most of the work — since almost everything has already been written by the TensorFlow authors in an elegant and parametric way. Learning TensorFlow takes time, but once you have learned how to use the bricks, building a neural network for practical use is very fast and requires only a few lines of code.
The high-level libraries of TensorFlow are available only for the Python language, which once again confirms itself as the language of choice for this type of application — and it is no coincidence that we have dedicated one of our most successful courses to Python and Deep Learning applications with TensorFlow.
Find out more about our courses
To program a neural network with TensorFlow a personal computer and a Python IDE are enough.
Training a network on a set of real data requires great computational capacity and very long times — even of several days!
Today it is possible to purchase computational services on a pay-as-you-go basis from companies such as Amazon or Google itself; however, the training process is still a job for experts, and Data Scientists or Data Specialists are among the most sought-after and best-paid professionals on the market.
Once the network has been trained — that is, the values of the weights of the neural connections that make the network work as a data classifier with the desired accuracy have been calculated — the classification operation, that is, the calculation of the output starting from a sample of input data, is a fast, almost instantaneous process, computationally inexpensive.
In our research centre at the FabLab of Spazio Chirale in Garbatella, we have run already-trained neural networks on small processors such as Arduino’s ATMega328 or maker microcomputers such as Raspberry Pi.
Fortunately, since for several years neural networks have been intensively developed and trained all over the world, for the most common and recurring problems already-trained neural networks are starting to be available — downloadable as paid software components from company websites or specialised marketplaces, or for free in open source form — making it possible to research and develop new applications starting from a further category of bricks: ready-made models, that is, pieces of software, libraries or APIs that implement a specific model (structure) of neural network pre-trained on a domain of data of general interest.
It is along these lines that Google during 2018 launched its DIY Artificial Intelligence kits — playfully called AIY, meaning Artificial Intelligence Yourself.
To tell the truth, the Voice Kit — the first AIY kit presented to the market — had not enthused us: in fact it was a nice packaging to create an attractive cardboard box with an RGB illuminated button and speaker to package the Raspberry Pi interface towards Google’s voice-recognition services available in the Cloud, already widely used for dozens of smart products and prototypes that came out of our Fab Labs.
The Vision Kit, on the contrary, seems to us a decisive step forward. For the first time, in fact, the Neural Network is hosted and therefore executed locally within the hardware of the device being built.
This may seem incredible considering that — as is evident from the name of the kit — this is a system for artificial vision and, what’s more, based on the Raspberry Pi Zero WH microcomputer: an entry-level board costing around 10 euros, which on paper should process and feed to a probable convolutional neural network, in real time, an HD-resolution colour video stream!
This was actually made possible by the development of additional hardware — a bonnet, to use the terminology more consistent with the Raspberry Pi Zero world — which acts as a specialised video and neural co-processor, leaving the microboard with only the task of receiving the network’s output and driving the actuators that stage the related results according to the desired special effects.
The real heart of the system is therefore the Vision Bonnet, a PCB that hosts the now famous Intel Movidius Myriad 2 VPU Neural Processor, which makes it possible to process the video stream and execute the feed forward operations of the neural network, and its own MCU that allows servo motors and LEDs to be controlled without occupying further GPIO PINs on the Raspberry Pi Zero.
The kit comes complete with its own SD-card image with a Raspbian distribution customised by Google that includes TensorFlow and the Python aiy.vision package, which allows the development of AI applications specific to the kit. The distribution includes numerous usage examples for the main APIs that are part of the package.
From the GitHub repository of the AIY project it is possible to download a compiler — which unfortunately runs only on Intel Linux systems — to transform a TensorFlow frozen graph (i.e. a neural-network model developed and already trained with TensorFlow) into a binary-format graph loadable on the Vision Bonnet at run time.
It is therefore possible to design and build your own artificial-vision models, training the networks on a sufficiently powerful TensorFlow development system, and export the graphs by compiling them for the Vision Bonnet + Raspberry Pi system, allowing the construction of prototypes and interactive products according to maker-culture methods.
In any case, the limits in terms of processing resources of the Vision Bonnet system must be kept in mind, so Google offers scripts to verify the compatibility of the models developed with the capabilities of this kit — which remains, however, a tinkering platform rather than a real development one.
By assembling the kit according to the instructions provided on the website dedicated to the AIY project, you build a fun cardboard box on which by default a facial-expression recognition demo is active. Whenever faces are present in the camera’s field of view, they are identified and each is attributed a score based on the degree of joy shown by the face’s expression. The RGB colour of the illuminated button varies from blue to yellow according to the average joy value calculated by the system. If you smile very obviously, the kit emits joyful beeps through the included buzzer.
The assembly instructions are well done and very clear, clearly aimed at people not very experienced with the Linux and Raspberry Pi world. To do anything beyond playing with the default demo, you need to access the Raspberry Pi by connecting directly with mouse, keyboard and monitor, or remotely via SSH terminal — in which case the Raspberry must be connected to the Wi-Fi network.
To configure the Wi-Fi network the official instructions list only two methods: the use of a dedicated app for Android smartphones, or the use of monitor, mouse and keyboard, which on the Pi Zero however requires a USB hub with Micro-USB input.
Not having at hand on the table used for the setup of the first kit either an Android smartphone or a suitable USB hub, we prosaically went ahead and performed a headless configuration of the Raspberry Pi Zero — much more standard than the bizarre alternative via dedicated app, inexplicably not cited by the official instructions among the various possibilities.
What we like most is that the kit is easily hackable and usable in any maker project. Just as it happens with Lego, the fun begins when you throw away the instructions for building the kit shown on the box and you start to create!