BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Apple Has Released Core ML 2

Apple Has Released Core ML 2

This item in japanese

At WWDC Apple released Core ML 2: a new version of their machine learning SDK for iOS devices. This new version speeds up inference time, provides the Create ML tool that allows developers to create and train custom machine learning models locally on their Mac, and enables Keras and sci-kit learn users to import their models directly into Core ML

The new release of Core ML, whose first version was released in June 2017, should create an inference time speedup of 30% for apps developed using Core ML 2. They achieve this using two techniques call "batch prediction" and "quantization". Batch prediction refers to the practice of predicting for multiple inputs at the same time (e.g. four images at the same time, instead of predicting these images one by one). Quantization is the practice of representing weights and activation in fewer bits during inference than during training. During training, you can use floating-point numbers used for weights and activations, but they slow down computation a lot during inference on non-GPU devices. By representing them in either 8 or 16 bits you still get the results you care about, but your network is both faster than before and 75% smaller.

An important new feature of the Core ML SDK is Create ML. Using Swift and macOS playgrounds developers can create and train custom machine learning models on their Mac. They can then integrate their model into their app with Core ML.

In their talks, Apple also gave an example of how the company Memrise, a site where people learn another language, used their Core ML tool. Previously their developers needed 24 hours to train a model using 20,000 images. When using Create ML and Core ML 2 they reduced this time to only 48 minutes on a MacBook Pro, and 18 minutes on an iMac Pro. It also enabled them to reduce their model size from 90MB to 3MB.

Users of Keras and sci-kit learn can import their models directly into Core ML. One downside of Core ML is that it's not possible to import TensorFlow models. However, there is a public tool released by Google that can convert them to a format that you can import.  

You can learn more about Core ML 2 on Apple's machine learning site. You can also find other information on how machine learning is integrated into Apple products in their machine learning journal.

Rate this Article

Adoption
Style

BT