To get the most out of this book
For most of the chapters, with the exception of Chapter 10, Deploying a CIFAR-10 Model for Memory-Constrained Devices with the Zephyr OS on QEMU, you will need a computer (either a laptop or desktop) running Linux (preferably Ubuntu 20.04+), macOS, or Windows operating systems on an x86_64 architecture. Additionally, your computer should have a minimum of two USB ports.
In Chapter 10, you will specifically require a computer running either Linux (preferably Ubuntu 20.04+) or macOS on an x86_64 architecture.
It is worth noting that most projects can also be developed on Macs powered by Apple silicon, such as M1 or M2 chips. However, at the time of writing, there is no support for the SparkFun RedBoard Artemis Nano on Apple silicon devices.
The only software prerequisites for your computer are:
- Python (Python 3.7+)
- A text editor (for example, gedit on Ubuntu)
- A media player (for example, VLC)
- An image viewer (for example, the default image viewer in your OS)
- A web browser (for example, Google Chrome)
During our tinyML journey, we will require different software tools to cover ML development and embedded programming. Thanks to Arduino, Edge Impulse, and Google, these tools will be in the cloud, browser-based, and have a free plan for our usage.
You can develop projects on the Arduino Nano 33 BLE Sense and Raspberry Pi Pico directly in your web browser using the Arduino Web Editor (https://create.arduino.cc). However, at the time of writing, the Arduino Web Editor has a limit of 25 compilations per day. Therefore, you may consider upgrading to any paid plan or using the free local Arduino IDE (https://www.arduino.cc/en/software) to get unlimited compilations. For those interested in the free local Arduino IDE, we have provided the instructions to install the local Arduino IDE on GitHub (https://github.com/PacktPublishing/TinyML-Cookbook_2E/tree/main/Docs/setup_local_arduino_ide.md).
For projects involving the SparkFun RedBoard Artemis Nano, you must use the local Arduino IDE. You can find the setup instructions for developing projects on this microcontroller by following this link: https://github.com/PacktPublishing/TinyML-Cookbook_2E/blob/main/Docs/setup_sparkfun_artemis_nano.md.
The projects we will develop together require sensors and additional electronic components to build realistic tinyML prototypes and experience the complete development workflow. These components are listed at the beginning of each chapter and in the README.md
file within the corresponding chapter folder on GitHub.
Since we will build real electronic circuits, we require an electronic components kit with at least a solderless breadboard, colored LEDs, resistors, push-buttons, and jumper wires. Don’t worry if you are a beginner in electronics. You will learn more about these components in the first two chapters of this book. Furthermore, we have prepared a beginner shopping list on GitHub so you know precisely what to buy: https://github.com/PacktPublishing/TinyML-Cookbook_2E/tree/main/Docs/shopping_list.md.
Download the example code files
The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/TinyML-Cookbook_2E.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781837637362.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “To do so, import the os
Python module to use its listdir()
method, which lists all the files in a specified directory.”
A block of code is set as follows:
def representative_data_gen():
data = tf.data.Dataset.from_tensor_slices(x_test)
for i_value in data.batch(1).take(100):
i_value_f32 = tf.dtypes.cast(i_value, tf.float32)
yield [i_value_f32]
Any command-line input or output is written as follows:
$ arduino-cli core install arduino:mbed_nano
Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “Scan the quick response (QR) code with your smartphone to pair the device with Edge Impulse.”
Warnings or important notes appear like this.
Tips and tricks appear like this.