O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required


Book Description

Neural networks are getting smaller. Much smaller. The OK Google team, for example, has run machine learning models that are just 14 kilobytes in size—small enough to work on the digital signal processor in an Android phone. With this practical book, you’ll learn about TensorFlow Lite for Microcontrollers, a miniscule machine learning library that allows you to run machine learning algorithms on tiny hardware.

Authors Pete Warden and Daniel Situnayake explain how you can train models that are small enough to fit into any environment, including small embedded devices that can run for a year or more on a single coin cell battery. Ideal for software and hardware developers who want to build embedded devices using machine learning, this guide shows you how to create a TinyML project step-by-step. No machine learning or microcontroller experience is necessary.

  • Learn practical machine learning applications on embedded devices, including simple uses such as speech recognition and gesture detection
  • Train models such as speech, accelerometer, and image recognition, you can deploy on Arduino and other embedded platforms
  • Understand how to work with Arduino and ultralow-power microcontrollers
  • Use techniques for optimizing latency, energy usage, and model and binary size

Table of Contents

  1. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. O’Reilly Safari
    4. How to Contact Us
    5. Acknowledgments
  2. 1. Introduction
    1. What is Tiny ML?
      1. What platforms does Tiny ML include?
    2. Embedded devices
  3. 2. Getting Started
    1. Who is this book aimed at?
    2. What hardware do you need?
    3. What software do you need?
    4. What do we hope you’ll learn?
  4. 3. Get Up to Speed on Machine Learning
    1. What we are going to learn
    2. What machine learning actually is
    3. The deep learning workflow
      1. 1. Decide on a goal
      2. 2. Collect a dataset
      3. 3. Design a model architecture
      4. 5. Train the model
      5. 6. Convert the model
      6. 7. Run inference
  5. 4. TensorFlow Lite for Microcontrollers
    1. What is TensorFlow Lite for Microcontrollers?
      1. TensorFlow
      2. TensorFlow Lite
      3. TensorFlow Lite for Microcontrollers
      4. Requirements
      5. Why is it interpreted?
      6. Project generation
    2. Build systems
      1. Specializing code
      2. Makefiles
      3. Writing Tests
    3. Supporting a new hardware platform
      1. Figure out how to print to a log
      2. Implement DebugLog()
      3. Run all the targets
      4. Integrating with the makefile build
    4. Supporting a new IDE or build system
    5. Integrating code changes between projects and repositories
    6. Contributing back to open source
    7. Supporting new hardware accelerators
    8. Understanding the file format
  6. 5. Optimizing Latency
    1. First make sure it matters
    2. Hardware changes
    3. Model improvements
      1. Estimating model latency
      2. How to speed up your model
    4. Product design
    5. Code optimizations
      1. Performance profiling
    6. Optimizing operations
      1. Look for existing optimized implementations
      2. Write your own optimized implementation
      3. Taking advantage of hardware features
      4. Accelerators and co-processors
    7. Contributing back to open source
  7. 6. Is My Problem Feasible?
    1. Do you need a microcontroller, or will a larger device work?
    2. Understanding what’s possible
    3. Follow in someone else’s footsteps
    4. Find some similar models to train
    5. Look at the data
    6. Wizard of Oz-ing
    7. Get it working on the desktop first