Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
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

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

Table of Contents (16) Chapters close

Title Page
Packt Upsell
Contributors
Preface
1. Introduction to Machine Learning 2. Introduction to Apple Core ML 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 1. Other Books You May Enjoy Index

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 a single instance; because this is where most of the changes reside, we will start from scratch. So, go ahead and delete the method...

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