Learn how to deploy complex Machine Learning models on single board computers, mobile phones, and microcontrollers.
Key Features
- Gain a comprehensive understanding of TinyML's core concepts.
- Learn how to design your own TinyML applications from the ground up.
- Explore cutting-edge models, hardware, and software platforms for developing TinyML.
Description
TinyML is an innovative technology that empowers small and resource-constrained edge devices with the capabilities of Machine Learning. If you're interested in deploying Machine Learning models directly on microcontrollers, single board computers, or mobile phones without relying on continuous cloud connectivity, this book is an ideal resource for you.
The book begins with a refresher on Python, covering essential concepts and popular libraries like NumPy and Pandas. It then delves into the fundamentals of neural networks and explores the practical implementation of deep learning using TensorFlow and Keras. Furthermore, the book provides an in-depth overview of TensorFlow Lite, a specialized framework for optimizing and deploying models on edge devices. It also discusses various model optimization techniques that reduce the model size without compromising performance. As the book progresses, it offers a step-by-step guidance on creating deep learning models for object detection and face recognition specifically tailored for the Raspberry Pi. You will also be introduced to the intricacies of deploying TensorFlow Lite applications on real-world edge devices. Lastly, the book explores the exciting possibilities of using TensorFlow Lite on microcontroller units (MCUs), opening up new opportunities for deploying Machine Learning models on resource-constrained devices.
TinyML is going to be the next big thing in Machine Learning. Major tech giants are heavily investing in standardizing the hardware and software stack. In this book, we cover the basic concepts of TinyML through practical coding examples to enable the readers to learn the basic concepts of TinyML and develop their own applications. Rather than discussing every single mathematical concept behind the Machine Learning algorithms, the book primarily focuses on end-to-end application development through coding examples. The projects covered in this book are implemented in open-source software commonly used in industry and academics.
Overall, this book serves as a valuable resource for anyone interested in harnessing the power of Machine Learning on edge devices.
What you will learn
- Explore different hardware and software platforms for designing TinyML.
- Create a deep learning model for object detection using the MobileNet architecture.
- Optimize large neural network models with the TensorFlow Model Optimization Toolkit.
- Explore the capabilities of TensorFlow Lite on microcontrollers.
- Build a face recognition system on a Raspberry Pi.
- Build a keyword detection system on an Arduino Nano.
Who this book is for
This book is designed for undergraduate and postgraduate students in the fields of Computer Science, Artificial Intelligence, Electronics, and Electrical Engineering, including MSc and MCA programs. It is also a valuable reference for young professionals who have recently entered the industry and wish to enhance their skills.
Author(s): Rohan Banerjee
Publisher: BPB Publications
Year: 2023
Language: English
Pages: 308
Book title
Inner title
Copyright
Dedicated
About the Author
About the Reviewers
Acknowledgements
Preface
Code Bundle and Coloured Images
Piracy
Table of Contents
Chapter 1: Introduction to TinyML and its Applications
Introduction
Structure
Objectives
Brief overview of Machine Learning
Supervised Machine Learning
Unsupervised Machine Learning
Machine Learning and Deep Learning
Edge computing and TinyML
Applications of TinyML
Hardware for deploying TinyML
Software for TinyML
Process flow of creating TinyML applications
Prerequisites—hardware and software
Conclusion
Key facts
Chapter 2: Crash Course on Python and TensorFlow Basics
Introduction
Structure
Objectives
Colab Notebook
Python variables
Python strings
Lists
Tuple
Dictionary
Conditional and logical operations
Loops in Python
Functions in Python
Python libraries
NumPy library
Matplotlib library
Pandas library
Introduction to TensorFlow
Tensors and datatypes
Differentiation in TensorFlow
Graphs and functions in TensorFlow
End-to-end Machine Learning algorithm using TensorFlow
Conclusion
Key facts
Further reading
Chapter 3:
Gearing with Deep Learning
Introduction
Structure
Objectives
Theory of artificial neural networks
Binary cross entropy loss function
Neural network activation functions
Learning the neural network weights—the backpropagation algorithm
Introduction to Convolutional Neural Network
Architecture of a CNN
Putting them all together
Neural network hyperparameters
Number of layers
Learning rate
Dropout
Regularization
Choice of optimization algorithm
Mini-batch size
Conclusion
Key facts
Further reading
Chapter 4: Experiencing TensorFlow
Introduction
Structure
Objectives
Keras and TensorFlow
Classification of handwritten digits using a feedforward neural network
Data processing
Model implementation
Implementation of a Convolutional Neural Network
Evaluation metrics in classification models
Conclusion
Key facts
Chapter 5: Model Optimization Using TensorFlow
Introduction
Structure
Objectives
Experiencing TensorFlow Lite
TensorFlow Model Optimization Toolkit
Quantization
Weight pruning
Weight clustering
Collaborative optimization
Conclusion
Key facts
Chapter 6: Deploying My First TinyML Application
Introduction
Structure
Objectives
The MobileNet architecture
Depthwise separable convolution
Image classification using MobileNet
Brief introduction to transfer learning
Implementing MobileNet using transfer learning
Creating an optimized model for a smaller target device
Evaluation of the model on the test set
Introduction to Raspberry Pi
Getting started with the Pi
Installing the operating system
Setting up the Pi
Remotely accessing the Pi
Deploying the model on Raspberry Pi to make inference
Conclusion
Key facts
Chapter 7: Deep Dive into Application Deploymen
t
Introduction
Structure
Objectives
System requirement
The face recognition pipeline
Setting up the Raspberry Pi for face recognition
The Raspberry Pi camera module
Installing the necessary libraries
Implementation of the project
Data collection for training
Model training
Real-time face recognition
Conclusion
Key facts
Chapter 8: TensorFlow Lite for Microcontrollers
Introduction
Structure
Objectives
Arduino Nano 33 BLE Sense
Setting up the Arduino Nano
First TinyML project on the microcontroller—modulating the potentiometer
Required components
Connecting the circuit
Read potentiometer to control the brightness of the LED
Creating a TensorFlow model to modulate the potentiometer reading
Inference on Arduino Nano using TensorFlow Lite for Microcontrollers
Conclusion
Key facts
Chapter 9: Keyword Spotting on Microcontrollers
Introduction
Structure
Objectives
Working principles of a voice assistant
Implementation of a keyword spotting algorithm in Python
Audio spectrogram
Designing a Convolutional Neural Network model for keyword spotting
Introduction to Edge Impulse
Implementing keyword spotting in Edge Impulse
Model deployment
Conclusion
Key facts
Chapter 10: Conclusion and Further Reading
Introduction
Structure
Objectives
Brief learning summary
TinyML best practices
AutoML and TinyML
Edge ML on smartphones
Future of TinyML
Further reading
Appendix
Index
Back title