Understanding CoreML

Due to the complex nature of machine learning and using trained models, Apple has built CoreML to make incorporating a trained model as simple as possible. On top of this, another goal was to ensure that whenever you implement machine learning using CoreML, your implementation is as fast and energy efficient as possible. Since Apple has been enhancing iOS with machine learning for a couple of years now, they have loads of experience of implementing complex models in apps.

If you have ever researched machine learning, you might have come across cloud-based solutions. Typically, you send a bunch of data to such a cloud-based solution, and the result is passed back as a response to your request. CoreML is very different, since the trained model lives on the device, instead of in the cloud. This means that your user's data never has to leave the device, which is very good for your user's privacy. Also, having your trained model on the device means that no internet connection is required to use CoreML, which saves both time and precious data. And since there is no potential bottleneck regarding response latency, CoreML is capable of calculating results in real time.

In the previous section, you learned that there are several types of trained models. Each type of model is used slightly differently, so if you were to implement machine learning in your app manually, you would have to write different wrappers around each of the different models your app uses. CoreML makes sure that you can use each type of model without even being aware of this in your app; they all share the same programming interface. A CoreML model is domain agnostic.

To be domain agnostic, all trained models that you use with CoreML must be in a particular format. Since machine learning already has a vibrant community with several popular formats, Apple has made sure that the most popular models can be easily converted to Apple's own .mlmodel format. Let's see how to obtain .mlmodel files for you to use in your own apps.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset