Intelligent Mobile Projects with TensorFlow

Book description

Create Deep Learning and Reinforcement Learning apps for multiple platforms with TensorFlow

About This Book
  • Build TensorFlow-powered AI applications for mobile and embedded devices
  • Learn modern AI topics such as computer vision, NLP, and deep reinforcement learning
  • Get practical insights and exclusive working code not available in the TensorFlow documentation
Who This Book Is For

If you're an iOS/Android developer interested in building and retraining others' TensorFlow models and running them in your mobile apps, or if you're a TensorFlow developer and want to run your new and amazing TensorFlow models on mobile devices, this book is for you. You'll also benefit from this book if you're interested in TensorFlow Lite, Core ML, or TensorFlow on Raspberry Pi.

What You Will Learn
  • Classify images with transfer learning
  • Detect objects and their locations
  • Transform pictures with amazing art styles
  • Understand simple speech commands
  • Describe images in natural language
  • Recognize drawing with Convolutional Neural Network and Long Short-Term Memory
  • Predict stock price with Recurrent Neural Network in TensorFlow and Keras
  • Generate and enhance images with generative adversarial networks
  • Build AlphaZero-like mobile game app in TensorFlow and Keras
  • Use TensorFlow Lite and Core ML on mobile
  • Develop TensorFlow apps on Raspberry Pi that can move, see, listen, speak, and learn
In Detail

As a developer, you always need to keep an eye out and be ready for what will be trending soon, while also focusing on what's trending currently. So, what's better than learning about the integration of the best of both worlds, the present and the future? Artificial Intelligence (AI) is widely regarded as the next big thing after mobile, and Google's TensorFlow is the leading open source machine learning framework, the hottest branch of AI. This book covers more than 10 complete iOS, Android, and Raspberry Pi apps powered by TensorFlow and built from scratch, running all kinds of cool TensorFlow models offline on-device: from computer vision, speech and language processing to generative adversarial networks and AlphaZero-like deep reinforcement learning. You'll learn how to use or retrain existing TensorFlow models, build your own models, and develop intelligent mobile apps running those TensorFlow models. You'll learn how to quickly build such apps with step-by-step tutorials and how to avoid many pitfalls in the process with lots of hard-earned troubleshooting tips.

Style and approach

This book takes a practical, project-based approach to teach specifics of mobile development with TensorFlow. Using a reader-friendly approach, this book will provide detailed instructions and also discuss the broader context covered within.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Intelligent Mobile Projects with TensorFlow
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  5. Foreword
  6. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. When to read the book
      2. Download the example code files
      3. Conventions used
    4. Get in touch
      1. Reviews
  8. Getting Started with Mobile TensorFlow
    1. Setting up TensorFlow
      1. Setting up TensorFlow on MacOS
      2. Setting up TensorFlow on GPU-powered Ubuntu
    2. Setting up Xcode
    3. Setting up Android Studio
    4. TensorFlow Mobile vs TensorFlow Lite
    5. Running sample TensorFlow iOS apps
    6. Running sample TensorFlow Android apps
    7. Summary
  9. Classifying Images with Transfer Learning
    1. Transfer learning – what and why
    2. Retraining using the Inception v3 model
    3. Retraining using MobileNet models
    4. Using the retrained models in the sample iOS app
    5. Using the retrained models in the sample Android app
    6. Adding TensorFlow to your own iOS app
      1. Adding TensorFlow to your Objective-C iOS app
      2. Adding TensorFlow to your Swift iOS app
    7. Adding TensorFlow to your own Android app
    8. Summary
  10. Detecting Objects and Their Locations
    1. Object detection–a quick overview
    2. Setting up the TensorFlow Object Detection API
      1. Quick installation and example
      2. Using pre-trained models
    3. Retraining SSD-MobileNet and Faster RCNN models
    4. Using object detection models in iOS
      1. Building TensorFlow iOS libraries manually
      2. Using TensorFlow iOS libraries in an app
      3. Adding an object detection feature to an iOS app
    5. Using YOLO2–another object-detection model
    6. Summary
  11. Transforming Pictures with Amazing Art Styles
    1. Neural Style Transfer – a quick overview
    2. Training fast neural-style transfer models
    3. Using fast neural-style transfer models in iOS
      1. Adding and testing with fast neural transfer models
      2. Looking back at the iOS code using fast neural transfer models
    4. Using fast neural-style transfer models in Android
    5. Using the TensorFlow Magenta multi-style model in iOS
    6. Using the TensorFlow Magenta multi-style model in Android
    7. Summary
  12. Understanding Simple Speech Commands
    1. Speech recognition – a quick overview
    2. Training a simple commands recognition model
    3. Using a simple speech recognition model in Android
      1. Building a new app using the model
      2. Showing model-powered recognition results
    4. Using a simple speech recognition model in iOS with Objective-C
      1. Building a new app using the model
      2. Fixing model-loading errors with tf_op_files.txt
    5. Using a simple speech recognition model in iOS with Swift
    6. Summary
  13. Describing Images in Natural Language
    1. Image captioning – how it works
    2. Training and freezing an image captioning model
      1. Training and testing caption generation
      2. Freezing the image captioning model
    3. Transforming and optimizing the image captioning model
      1. Fixing errors with transformed models
      2. Optimizing the transformed model
    4. Using the image captioning model in iOS
    5. Using the image captioning model in Android
    6. Summary
  14. Recognizing Drawing with CNN and LSTM
    1. Drawing classification – how it works
    2. Training, predicting, and preparing the drawing classification model
      1. Training the drawing classification model
      2. Predicting with the drawing classification model
      3. Preparing the drawing classification model
    3. Using the drawing classification model in iOS
      1. Building custom TensorFlow library for iOS
      2. Developing an iOS app to use the model
    4. Using the drawing classification model in Android
      1. Building custom TensorFlow library for Android
      2. Developing an Android app to use the model
    5. Summary
  15. Predicting Stock Price with RNN
    1. RNN and stock price prediction – what and how
    2. Using the TensorFlow RNN API for stock price prediction
      1. Training an RNN model in TensorFlow
      2. Testing the TensorFlow RNN model
    3. Using the Keras RNN LSTM API for stock price prediction
      1. Training an RNN model in Keras
      2. Testing the Keras RNN model
    4. Running the TensorFlow and Keras models on iOS
    5. Running the TensorFlow and Keras models on Android
    6. Summary
  16. Generating and Enhancing Images with GAN
    1. GAN – what and why
    2. Building and training GAN models with TensorFlow
      1. Basic GAN model of generating handwritten digits
      2. Advanced GAN model of enhancing image resolution
    3. Using the GAN models in iOS
      1. Using the basic GAN model
      2. Using the advanced GAN model
    4. Using the GAN models in Android
      1. Using the basic GAN model
      2. Using the advanced GAN model
    5. Summary
  17. Building an AlphaZero-like Mobile Game App
    1. AlphaZero – how does it work?
    2. Training and testing an AlphaZero-like model for Connect 4
      1. Training the model
      2. Testing the model
      3. Looking into the model-building code
      4. Freezing the model
    3. Using the model in iOS to play Connect 4
    4. Using the model in Android to play Connect 4
    5. Summary
  18. Using TensorFlow Lite and Core ML on Mobile
    1. TensorFlow Lite – an overview
    2. Using TensorFlow Lite in iOS
      1. Running the example TensorFlow Lite iOS apps
      2. Using a prebuilt TensorFlow Lite model in iOS
      3. Using a retrained TensorFlow model for TensorFlow Lite in iOS
      4. Using a custom TensorFlow Lite model in iOS
    3. Using TensorFlow Lite in Android
    4. Core ML for iOS – an overview
    5. Using Core ML with Scikit-Learn machine learning
      1. Building and converting the Scikit Learn models
      2. Using the converted Core ML models in iOS
    6. Using Core ML with Keras and TensorFlow
    7. Summary
  19. Developing TensorFlow Apps on Raspberry Pi
    1. Setting up Raspberry Pi and making it move
      1. Setting up Raspberry Pi
      2. Making Raspberry Pi move
    2. Setting up TensorFlow on Raspberry Pi
    3. Image recognition and text to speech
    4. Audio recognition and robot movement
    5. Reinforcement learning on Raspberry Pi
      1. Understanding the CartPole simulated environment
      2. Starting with basic intuitive policy
      3. Using neural networks to build a better policy
    6. Summary
    7. Final words
  20. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Intelligent Mobile Projects with TensorFlow
  • Author(s): Jeff Tang
  • Release date: May 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788834544