Book Image

Machine Learning with Core ML

Book Image

Machine Learning with Core ML

Overview of this book

Core ML is a popular framework by Apple, with APIs designed to support various machine learning tasks. It allows you to train your machine learning models and then integrate them into your iOS apps. Machine Learning with Core ML is a fun and practical guide that not only demystifies Core ML but also sheds light on machine learning. In this book, you’ll walk through realistic and interesting examples of machine learning in the context of mobile platforms (specifically iOS). You’ll learn to implement Core ML for visual-based applications using the principles of transfer learning and neural networks. Having got to grips with the basics, you’ll discover a series of seven examples, each providing a new use-case that uncovers how machine learning can be applied along with the related concepts. By the end of the book, you will have the skills required to put machine learning to work in their own applications, using the Core ML APIs
Table of Contents (16 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Preparing the data


For our task, we require a collection of labeled photos of fruits. As you may recall from Chapter 1Introduction to Machine Learning, this type of machine learning problem is known as supervised learning. We need our model to take in an image and return the label of what it thinks the image is, also known as multi-class classification

Go ahead and collect photos of fruits. Create ML allows for multiple ways of organizing your data, but I find that ad hoc collection is easiest done by organizing it in folders, as shown here:

Source: http://www.image-net.org/ 

Here, we have organized our data into folders, where the folder name is used as a label for its contents. An alternative is labeling each image, where each instance of a specific class has a suffix number, for example banana.0.jpg, banana.1.jpg, and so on. Or you can simply pass in a dictionary of labels with their associated list of image URLs.

At this stage, you may be wondering how many images you should get. Apple...