Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Machine Learning with Core ML

You're reading from  Machine Learning with Core ML

Product type Book
Published in Jun 2018
Publisher Packt
ISBN-13 9781788838290
Pages 378 pages
Edition 1st Edition
Languages

Table of Contents (16) Chapters

Title Page
Packt Upsell
Contributors
Preface
Introduction to Machine Learning Introduction to Apple Core ML Recognizing Objects in the World Emotion Detection with CNNs Locating Objects in the World Creating Art with Style Transfer Assisted Drawing with CNNs Assisted Drawing with RNNs Object Segmentation Using CNNs An Introduction to Create ML Other Books You May Enjoy Index

Creating and training a model


Thanks to the great effort by Apple's engineers, the process of creating common machine learning models is incredibly easy and will no doubt spark a new wave of intelligent apps over the coming months.

In this section, you will see just how easy it is as we walk through creating an image classifier for our application using Create ML.

Create ML is accessible using Xcode Playground, so there is a good place to start. Open up Xcode and create a new Playground, ensuring that you select macOS as the platform, as shown here: 

Once in the playground, import CreateML and Foundation as follows: 

import CreateML
import Foundation

Next, create a URL that points to the directory that contains your training data:

let trainingDir = URL(fileURLWithPath: "/<PATH TO DIRECTORY WITH TRAINING DATA>")

The only thing left to do is to create an instance of our model, passing in the path to our training data (I did say it was incredibly easy):

let model = try MLImageClassifier(
   ...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}