TinyML Cookbook Combine Machine Learning with Microcontrollers to Solve Real-World Problems
Discover the incredible world of tiny Machine Learning (tinyML) and create smart projects using real-world data sensors with the Arduino Nano 33 BLE Sense, Raspberry Pi Pico, and SparkFun RedBoard Artemis Nano. TinyML Cookbook, Second Edition, will show you how to build unique end-to-end ML applicat...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing
[2023]
|
Edición: | Second edition |
Colección: | Expert insight.
|
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009785405806719 |
Tabla de Contenidos:
- Cover
- Copyright
- Table of Contents
- Preface
- Chapter 1: Getting Ready to Unlock ML on Microcontrollers
- Technical requirements
- Introduction to tinyML
- What is tinyML?
- Why ML on microcontrollers?
- Why run ML on-device?
- The opportunities and challenges for tinyML
- Deployment environments for tinyML
- Join the tinyML community!
- Overview of deep learning
- Deep neural networks
- Convolutional neural networks
- Model quantization
- Learning the difference between power and energy
- Voltage versus current
- Power versus energy
- Programming microcontrollers
- Memory architecture
- Peripherals
- General-purpose input/output (GPIO or IO)
- Analog/digital converters
- Serial communication
- Timers
- Introduction to the development platforms
- Arduino Nano 33 BLE Sense
- Raspberry Pi Pico
- SparkFun RedBoard Artemis Nano
- Setting up the software development environment
- Getting ready with Arduino IDE
- Getting ready with TensorFlow
- Getting ready with Edge Impulse
- Deploying a sketch on microcontrollers
- Getting ready
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Summary
- Chapter 2: Unleashing Your Creativity with Microcontrollers
- Technical requirements
- Transmitting data over serial communication
- Getting ready
- How to do it…
- There's more…
- Reading serial data and uploading files to Google Drive with Python
- Getting ready
- Reading data from the serial port with pySerial
- Enabling the Google Drive API
- How to do it…
- There's more…
- Implementing an LED status indicator on the breadboard
- Getting ready
- Prototyping on a breadboard
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Controlling an external LED with the GPIO
- Getting ready
- Understanding the LED functionality
- Introducing the GPIO peripheral.
- Using the mbed::DigitalOut function
- How to do it…
- Connecting the LED to the GPIO pin
- Programming the GPIO peripheral in output mode
- There's more…with the SparkFun Artemis Nano!
- Turning an LED on and off with a push button
- Getting ready
- The operating principles of the push-button
- How to do it…
- Connecting the push-button to the GPIO pin
- Programming the GPIO peripheral in input mode
- There's more…with the SparkFun Artemis Nano!
- Using interrupts to read the push-button state
- Getting ready
- Working with interrupts using the Mbed OS API
- How to do it...
- There's more…
- Summary
- Chapter 3: Building a Weather Station with TensorFlow Lite for Microcontrollers
- Technical requirements
- Importing weather data from WorldWeatherOnline
- Getting ready
- How to do it…
- There's more…
- Preparing the dataset
- Getting ready
- Balancing the dataset
- Feature scaling with Z-score
- How to do it…
- There's more…
- Training the model with TensorFlow
- Getting ready
- How to do it…
- There's more…
- Evaluating the model's effectiveness
- Getting ready
- Evaluating the performance with the confusion matrix
- Evaluating recall, precision, and F-score
- How to do it…
- There's more…
- Quantizing the model with the TensorFlow Lite converter
- Getting ready
- Model quantization
- How to do it…
- There's more…
- Reading temperature and humidity data with the Arduino Nano
- Getting ready
- How to do it…
- There's more…
- Reading temperature and humidity with the DHT22 sensor and the Raspberry Pi Pico
- Getting ready
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Preparing the input features for the model inference
- Getting ready
- How to do it…
- There's more…with the SparkFun Artemis Nano
- On-device inference with TensorFlow Lite for Microcontrollers
- Getting ready.
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Summary
- Chapter 4: Using Edge Impulse and the Arduino Nano to Control LEDs with Voice Commands
- Technical requirements
- Acquiring audio data with a smartphone
- Getting ready
- Collecting audio samples for KWS
- How to do it…
- There's more
- Acquiring audio data with the Arduino Nano
- Getting ready
- Collecting data using a fully supported platform in Edge Impulse
- How to do it…
- There's more
- Extracting MFE features from audio samples
- Getting ready
- Analyzing audio in the frequency domain
- Extracting the Mel-spectrogram
- How to do it…
- There's more
- Designing and training a CNN
- Getting ready
- How to do it…
- There's more
- Tuning model performance with the EON Tuner
- Getting ready
- How to do it…
- There's more
- Live classifications with a smartphone
- Getting ready
- How to do it…
- There's more
- Keyword spotting on the Arduino Nano
- Getting ready
- Learning how a real-time KWS application works
- How to do it…
- There's more
- Summary
- Chapter 5: Recognizing Music Genres with TensorFlow and the Raspberry Pi Pico - Part 1
- Technical requirements
- Connecting the microphone to the Raspberry Pi Pico
- Getting ready
- Connecting the microphone to the ADC pin
- How to do it…
- There's more…
- Recording audio samples with the Raspberry Pi Pico
- Getting ready
- Recording audio with ADC and timer interrupts
- Programming the ADC with the Raspberry Pi Pico SDK
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Generating audio files from samples transmitted over the serial
- Getting ready
- How to do it…
- There's more…
- Building the dataset for classifying music genres
- Getting ready
- Using the GTZAN dataset for music genre classification.
- Augmenting the dataset with audio samples taken with the Raspberry Pi Pico
- Choosing the suitable model input length
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Extracting MFCCs from audio samples with TensorFlow
- Getting ready
- Applying the Hann window
- Leveraging RFFT
- Calculating the FFT magnitude
- The Mel scale conversion
- Computing the DCT coefficients
- Evaluating the SRAM usage to run MFCCs
- How to do it…
- There's more…
- Summary
- References
- Chapter 6: Recognizing Music Genres with TensorFlow and the Raspberry Pi Pico - Part 2
- Technical requirements
- Computing the FFT magnitude with fixed-point arithmetic using the CMSIS-DSP library
- Getting ready
- Evaluating the hardware capabilities of the Raspberry Pi Pico
- Using the CMSIS-DSP Python library
- Representing numbers in 16-bit fixed-point format
- How to do it…
- There's more…
- Implementing the MFCCs feature extraction with the CMSIS-DSP library
- Getting ready
- Extracting the DCT coefficients
- How to do it…
- There's more…
- Designing and training an LSTM RNN model
- Getting ready
- Time series analysis with RNNs
- Designing a many-to-one RNN for music genre classification
- How to do it…
- There's more…
- Evaluating the accuracy of the quantized model on the test dataset
- Getting ready
- How to do it…
- There's more…
- Deploying the MFCCs feature extraction algorithm on the Raspberry Pi Pico
- Getting ready
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Recognizing music genres with the Raspberry Pi Pico
- Getting ready
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Summary
- Chapter 7: Detecting Objects with Edge Impulse Using FOMO onthe Raspberry Pi Pico
- Technical requirements
- Acquiring images with the webcam
- Getting ready
- Building a dataset for FOMO.
- How to do it…
- There's more…
- Designing the Impulse's pre-processing block
- Getting ready
- Choosing the correct input image resolution
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Transfer learning with FOMO
- Getting ready
- Behind the design of FOMO
- Locating objects from heat maps
- How to do it…
- There's more…
- Evaluating the model's accuracy
- Getting ready
- How to do it…
- There's more…
- Using OpenCV and pySerial to send images over the serial interface
- Getting ready
- Sending bytes over the serial with pySerial
- How to do it…
- There's more…
- Reading data from the serial port with Arduino-compatible platforms
- Getting ready
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Deploying FOMO on the Raspberry Pi Pico
- Getting ready
- Initializing the signal_t data structure
- Reading the output results from ei_impulse_result_t
- Transmitting the centroid coordinates to the Python script
- How to do it…
- There's more…with the SparkFun Artemis Nano!
- Summary
- Chapter 8: Classifying Desk Objects with TensorFlow and the Arduino Nano
- Technical requirements
- Taking pictures with the OV7670 camera module
- Getting ready
- How to do it…
- There's more…
- Grabbing camera frames from the serial port with Python
- Getting ready
- Introducing the RGB565 color format
- Transmitting images over the serial
- How to do it…
- There's more...
- Acquiring QQVGA images with the YCbCr422 color format
- Getting ready
- Converting YCbCr422 to RGB888
- How to do it…
- There's more…
- Building the dataset to classify desk objects
- Getting ready
- How to do it…
- There's more…
- Transfer learning with Keras
- Getting ready
- Behind the MobileNet network design choices
- How to do it…
- There's more….
- Quantizing and testing the trained model with TensorFlow Lite.