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

Building Mobile Applications with TensorFlow

Book Description

Deep learning is an incredibly powerful technology for understanding messy data from the real world—and the TensorFlow machine learning library is the ideal way to harness that power. In this practical report, author Pete Warden, tech lead on the Mobile/Embedded TensorFlow team, demonstrates how to successfully integrate a Tensorflow deep-learning model into your Android and iOS mobile applications.

Aimed specifically at developers who already have a TensorFlow model successfully working in a desktop environment, this report shows you through hands-on examples how to deploy mobile AI applications that are small, fast, and easy to build. You’ll explore use cases for on-device deep learning—such as speech, image, and object recognition—and learn how to deliver interactive applications that complement cloud services.

With this report, you’ll explore:

  • Use cases including speech, image, and object recognition, translation, and text classification
  • Common patterns for integrating a deep-learning model into your application
  • Several examples for running TensorFlow on Android, iOS, and Raspberry Pi
  • Techniques for testing your deep-learning model inside your application
  • Methods to help you prepare your solution for mobile deployment
  • Optimizing your model for latency, RAM usage, model file size, and binary size

Table of Contents

  1. Building Mobile Apps with TensorFlow
    1. Challenges of Building a Mobile App with TensorFlow
    2. Understanding the Basics of TensorFlow
      1. What Is TensorFlow?
      2. What Level of Knowledge Do You Need?
      3. What Hardware and Software Should You Have?
      4. What Is TensorFlow Useful for on Mobile?
      5. How Does It Fit with the Cloud?
      6. What Should You Do Before You Get Started?
      7. Common Model Patterns
    3. Building TensorFlow for Your Platform
      1. Android
      2. Android Inference Library
      3. iOS
      4. Raspberry Pi
    4. Integrating the TensorFlow Library into Your Application
      1. Linking the Library
      2. Global Constructor Magic
      3. Protobuf Problems
      4. Protobuf Compatibility Issues
      5. Calling the TensorFlow API
      6. C++ op API
      7. Training On-Device
      8. What Are the Minimum Device Requirements for TensorFlow?
    5. Preparing Your Model File for Mobile Deployment
      1. What’s Up with All the Different Saved File Formats?
      2. How Do You Get a Model You Can Use on Mobile?
      3. Using the Graph Transform Tool
      4. What Ops Are Available on Mobile?
    6. Optimizing for Latency, RAM Usage, Model File Size, and Binary Size
      1. Model Size
      2. Speed
      3. How to Profile Your Model
      4. Profiling Within Your Own App
      5. Visualizing Models
      6. Threading
      7. Binary Size
      8. Retrain with Mobile Data
      9. Need to Reduce Model Loading Time or Memory Footprint?
      10. Protecting Model Files from Easy Copying
    7. Exploring Quantized Calculations
    8. Quantization Challenges
      1. Quantized Representation
      2. Representation Drawbacks
      3. Using Quantized Calculations in TensorFlow
      4. Why Does Quantization Removal Matter?
      5. Activation Ranges
      6. Dynamic Ranges
      7. Observed Ranges
      8. Trained Ranges
    9. What Next?