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

Reducing your model's weight


We have spent considerable time discussing layers of a network; we have learned that layers are made up of weights, configured in such a way that they can transform an input into a desirable output. These weights come at a cost, though; each one (by default) is a 32-bit floating-point number with a typical model, especially in computer vision, having millions resulting in networks that are hundreds of megabytes in size. On top of that; it's plausible that your application will have multiple models (with this chapter being a good example, requiring a model for each style). 

Fortunately, our model in this chapter has a moderate number of weights and weighs in at a mere 2.2 MB; but this is possibly an exception. So we'll use this chapter as an excuse to explore some ways we can reduce our model's weights. But before doing so, let's quickly discuss why, even though it's probably obvious. The three main reasons why you should be conscious of your model's size include...