Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning with Core ML

You're reading from   Machine Learning with Core ML An iOS developer's guide to implementing machine learning in mobile apps

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781788838290
Length 378 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Joshua Newnham Joshua Newnham
Author Profile Icon Joshua Newnham
Joshua Newnham
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Introduction to Machine Learning 2. Introduction to Apple Core ML FREE CHAPTER 3. Recognizing Objects in the World 4. Emotion Detection with CNNs 5. Locating Objects in the World 6. Creating Art with Style Transfer 7. Assisted Drawing with CNNs 8. Assisted Drawing with RNNs 9. Object Segmentation Using CNNs 10. An Introduction to Create ML 11. Other Books You May Enjoy

Optimizing with batches

At the moment, our process involves iterating over each photo and performing inference on each one individually. With the release of Core ML 2, we now have the option to create a batch and pass this batch to our model for inference. As with efficiencies gained with economies of scale, here, we also gain significant improvements; so let's walk through adapting our project to process our photos in a single batch rather than individually.

Let's work our way up the stack, starting in our YOLOFacade class and moving up to the PhotoSearcher. For this we will be using our model directly rather than proxying through Vision, so our first task is to replace the model property of our YOLOFacade class with the following declaration:

let model = tinyyolo_voc2007().model

Now, let's rewrite the detectObjects method to handle an array of photos rather than...

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 €18.99/month. Cancel anytime