Get started with Machine Learning for Apple and iOS!
Want to know a secret? Machine learning isn’t really that hard to learn. The truth is, you don’t need a PhD from a prestigious university or a background in mathematics to do machine learning. If you already know how to code, you can pick up machine learning quite easily — promise!
This book will get you started with machine learning on iOS and Apple devices. The first bit is a gentle introduction to the world of machine learning and what it has to offer — as well as what its limitations are. In the rest of the book, you’ll look at each of these topics in more detail, until you know enough to make machine learning a useful tool in your software development toolbox.
There are now several high-level Apple frameworks, including Natural Language, Speech, and Vision, that provide advanced machine learning functionality behind simple APIs as part of Apple’s iOS tooling. Whether you want to convert speech to text, recognize language or grammatical structure, detect faces in photos or track moving objects in video, these frameworks have got you covered.
In this book, you’ll learn how to use these tools and frameworks to make your apps smarter. Even better, you’ll learn how machine learning works behind the scenes — and why this technology is awesome.
This book is for all Apple and iOS developers who are interested in learning how to train models, code image recognition systems, learn how natural language processing works, build sequence classifiers and more.
Before You Begin
This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.
This section introduces you to the world of machine learning. You’ll get a high level view of what it is, and how it can be used on mobile. You’ll also get a quick primer on using Python for machine learning. You’ll learn how to set up an environment to use tools such as CreateML, Turi Create, and Keras for machine learning. Finally, you’ll learn how to use machine learning techniques to solve problems using images. The topics you’ll explore include image classification, object detection with bounding boxes, and object segmentation.
In this introduction chapter, you’ll learn what machine learning is all about. You’ll touch on everything from, the difference between supervised and unsupervised learning, to what transfer learning is. You’ll even go over the ethics of machine learning, and how bias can affect models.
In this chapter, you’ll build your first iOS app by adding a CoreML model to detect whether a snack is healthy or unhealthy. You’ll focus on how machine learning can be used to solve classification problems such as trying to identify what an object might be.
In this chapter, you’ll start to build your first machine learning model using Create ML. You’ll be introduced to the dataset used to create the model, along with how Create ML uses transfer learning to get amazing classification results. Moreover, you’ll learn what it means to evaluate the performance of your model.
In this chapter, you’ll get a quick primer on Python. You’ll learn how to setup your Python environment using Conda, and how to install external libraries. You’ll learn how to run and use Jupyter notebooks to iterate quickly with Python.
In this chapter, you’ll learn to use Turi Create to build a classification model. You’ll use the snacks dataset to create your model. You’ll learn how to analyze your model’s performance, and how to go under the hood with Turi Create in order to improve your model.
In this chapter, you’ll learn why a simple neural network might not be enough when it comes to solving problems with images using machine learning. You’ll learn about how using a convolutional neural network provides a better approach to solving classification problems.
In this chapter, you’ll learn about advanced model architectures used for solving image classification. You’ll learn how you can use Keras to do transfer learning, and how applying advanced techniques such as dropout and regularization can improve your model’s performance.
In this final chapter, you’ll learn about some advanced localization models. You’ll learn about one-shot detectors like YOLO and SSD and how they can be used to identify multiple objects in an image. You’ll also learn about how machine learning can be used for segmentation to separate an object from its background.
Section II: Machine Learning with Sequences
In this section, you’ll learn how to apply machine learning to sequential data. You’ll work on a new iOS app which attempts to identify a user’s activity using data from their iPhone’s motion sensors. In the process, you’ll learn how to build a good training dataset, how to create an activity classification model using Turi Create, and how to incorporate your model into an iOS app to support responsive classifications with real-time data.
In this chapter, you’ll learn how working with sequences differs from working with discrete data like individual images. You’ll learn how to collect iPhone sensor data, as well as what it takes to build a good training dataset.
In this chapter, you’ll learn about neural networks designed to work with sequences. You’ll also learn how to use Turi Create to train an activity classification model using data from the previous chapter.
In this chapter, you’ll learn how to pass real-time sequential data captured from a device’s motion sensors into your Core ML model. You’ll learn some tricks to help keep your apps responsive and accurate while processing sequences of streaming data.
Section III: Natural Language Processing
In this section, you’ll focus on a specific type of sequential data — natural language text. You’ll learn how to use Apple-provided APIs to perform common language processing tasks. You’ll also learn how to use text with neural networks, and you’ll create a model with Keras that translates text from Spanish to English. Finally, you’ll read about advanced techniques that you can experiment with to improve your model.
In this chapter, you’ll learn how to use Apple’s Natural Language framework to handle several useful text-related tasks. You’ll explore this API in the context of a movie review app that supports multiple languages.
In this chapter, you’ll learn about sequence-to-sequence models and how you can use them to do things like language translation. You’ll build a model with Keras that attempts to translate Spanish-language movie reviews into English.
Build your mobile development skills and save! The mobile development world moves quickly — and you don't want to get left behind. Stay ahead of the rest with an Ultimate book & video subscription. Starting at just $149/year for Black Friday.