TinyML: Machine Learning with TensorFlow Lite |
Written by Harry Fairhead | |||
Authors: Pete Warden and Daniel Situnayake The very obvious answer is no but this doesn't stop them implementing models built by other machines and this can be useful. Putting Machine Learning (ML) into practice is difficult if you have a powerful GPU-equipped machine to crunch the numbers it is even more challenging when coupled with the need to use a system on a chip or other small embedded device. However, it can be done and it can be done without having to hand over all of the heavy computation to the cloud. Devices such as Alexa and other voice assistants implement enough speech recognition to detect their wake word using just local processing, for example. TensorFlow Lite is a cut down version of TensorFlow that runs on small machines and this book shows you how to use it on Arduino Nano 33 BLE, the Sparkfun Edge and the STM32F746G Discovery Kit - although only the first two are used in all of the chapters. This most definitely isn't a book for you if you are going to complain that a particular version of a processor isn't supported, or even if you expect everything to just work. This isn't a complete solution to anything but rather a companion that will help you get things working, as long as you are prepared to understand and to debug. The first six chapters focus on a "hello world" example suitable for ML. Starting off from some basic ideas of ML we quickly implement a prediction algorithm for some noisy data. None of this is practically useful, apart from making you understand how the whole idea works - which of course is very useful. Most of the programming is in Python built on a desktop machine. It is only in Chapter 6 do we move on and find out how to install the model on the three example microcontroller systems. This is where you are most likely to run into difficulties because this is an area where documentation is poor and things change without notice. You will most likely have to do some independent work at this point. After this six-chapter introductory project the book moves on to more practical projects. Chapters 7 and 8 implement a wake word detector and makes use of the audio capabilties of the hardware. The final project as presented in the book doesn't seem to be good enough to be used in practice as it has low accuracy, but if you understand the ideas there is nothing stopping you from spending the hours it would most likely take to get to something workable. Chapters 9 and 10 repeat the basic steps only this time for a person detection model. Obviously in this case you need a video camera and this is likely to increase the difficulty of getting everything to work. In this case the ML model used is more complicated and you will need to read up on theory if you want to go further. Chapters 11 and 12 are about gesture recognition using the onboard accelerometer. As before, the results are not good enough to deploy in anything real, but again you could put in the work and extend them to something useful. The final part of the book, chapters 13 to 21, are about general issues rather than projects. Chapter 13 is a fairly long chapter on how TensorFlow Lite works and how to use it in more adventurous ways. Chapter 14 is a fairly waffly account of creating your own ML application and most of it should be obvious by this point in the book. Chapter 15 is about speeding up the model - i.e. performance optimization. Chapter 16 deals with power consumption and clearly this is very dependent on the device you plan to use, but it has some general advice and goes into how to measure power consumption. Chapter 17 is about reducing the size of models so that there is some RAM left over. Chapter 18 is about debugging - not so much code debugging as model debugging. Chapter 19 is about porting models from the big TensorFlow to the little TensorFlow Lite. Chapter 20 looks briefly at the important issues of privacy and security and has a single paragraph on moving from development to production. The final chapter is some recommendations on how to learn more. Overall this is a very good book if you want some examples of how to get a model working on TensorFlow Lite. If you expect the book to simply guide you through some sort of commercial or "real" implementation of any particular project then this is not the book for you - I also doubt that such a book could exist. This is not a kit of parts you can simply bolt onto whatever you are working on. It is a get-you-started with ML on small devices. It lacks any reasonably deep coverage of neural networks but if it did it would have to repeat what is already available in other books. You really do need to learn about models in general and then specialize to models suitable for small hardware. It also doesn't deal with any of the problems of programming the microcontrollers it uses - you are expected to already know about such things. As long as you aren't expecting final finished solutions handed to you on a plate, this is a good way to get started.
For recommendations of other books on Machine Learning see AI Books To Inspire You in our Programmer's Bookshelf section. To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.
|
|||
Last Updated ( Wednesday, 09 June 2021 ) |