Basics of Create ML and Turi Create

ML and Turi-01 blog image

In WWDC 2018, Apple unveiled some of the most advanced technological achievements in the field of Machine Learning by adding capabilities to train custom ML models with the help of Xcode and other available tools.

Apple basically introduced two ways to train custom ML models, one of which is Create ML and another one is their open-sourced version of 2016’s Apple acquired Turi, Turi Create.

Create ML

Create ML enables developers to create and train custom machine learning models on their Mac using familiar tools like Swift and macOS playgrounds. The user can train models to perform tasks like image recognition, text extraction or finding the relation between numeric values.

Create ML and Turi Create

Create ML uses the machine learning foundation worked into Apple products like Photos and Siri. This implies your image classification and natural language models are littler and set aside significantly less time to train. Create ML uses Transfer Learning on ML models to train the model again with new training data.

It is a highly recommended tool for developers to quickly adapt or start with Machine Learning and to use it for classification, regression, and others as well.

The company is working on setting up abstraction towards complex part of Machine Learning tasks, by introducing various easy to adopt techniques or tools to use custom models within the app itself with very less computing power consumption. This will attract developers who are don’t have a background in AI or ML to adopt this aspect and accelerate their app development skills.

However, If you are developing a fully customized and complex machine learning model and you are expecting to Create ML to help accelerate your development then you might lose your hope on Create ML. Yes, there are several limitations of Create ML, which you should be aware of before getting started with Create ML.

Limitations of Create ML

  • It has no backward compatibility for development, as you need at least macOS 10.14 or later.
  •  Being native, it is only useful for native developers, Machine Learning engineers should have knowledge of Swift or macOS playgrounds for using Create ML.
  •  Create ML has a narrow area of applications as it only allows limited sets of tasks to be performed.
  •  Create ML uses a predefined model for transfer learning for particular tasks such as image classification or text classification and others.
  • As training will be performed on your machine, it requires a quite powerful machine to complete the training in the desired time or else it will take longer on machines with lower computing power or GPU fewer machines.

Turi Create: Alternate to Create ML

Turi is an Apple acquired company focused on Artificial Intelligence and Machine Learning. Apple acquired it in August 2016 and then in December 2017 it released open-sourced version named Turi Create.

Turi Create is a must needed open source toolset for creating Core ML models. It allows developers to train their custom ML models using Python for tasks such as image classification, object detection, style transfers, recommendations, and more. After completion, those resulting models can be used in any of the Apple platforms (iOS, macOS, watchOS and tvOS).

Turi Create simplifies the development of custom Machine Learning models. Developers having some knowledge or no knowledge can perform objects detections, add recommendations, image classification, images similarity or activity classification within an app.

Benefits of Turi Create

  • Easy to use: Designed to reduce complexity, so the developers can focus on tasks instead of algorithms.
  •  Visual: Its built-in and it enables streaming visualizations to explore the data.
  • Flexible: It supports the variety of data which includes text, images, audio, video and sensor data.
  • Fast and Scalable: Designed to leverage native frameworks and resources, capable to work with large data sets on a single machine.
  • Ready To Deploy: Single line code to deploy/convert ML model to Core ML model and its ready to be used inside any iOS, macOS, watchOS or tvOS platform.

Capabilities

Turi Create offers default parameters, building blocks and baseline models for Application-oriented toolkits that help developers in getting started with their dataset.

  • Recommender Systems
  • Image Classification
  • Image Similarity
  • Object Detection
  • Style Transfer
  • Activity Classifier
  • Text Classifier

Create ML and Turi Create

Let’s prepare our own Core ML model using Turi Create :

If your system is not configured to use Turi Create, you can find the official installation guide from here  (https://github.com/apple/turicreate#installation).

Now start typing this commands in terminal one by one:

$ cd ~

$ virtualenv turienv

$ source ~/turienv/bin/activate

$ pip install turicreate==5.0b3

$ python -m pip install –upgrade pip

$ python -m pip install jupyter

$ jupyter notebook

This will open the default browser with Jupyter Notebook tab. Now you’re set to re-train your own model with Turi create.

Create ML and Turi Create

Here is a sample Style Transfer example code to create new style transfer model:

import turicreate as tc

 styles = tc.load_images(‘/Users/milanmanwar/Documents/style_transfer/style_images’)

content = tc.load_images(‘/Users/milanmanwar/Documents/style_transfer/content_images’)

 model = tc.style_transfer.create(styles, content)

 test_images = tc.load_images(‘/Users/milanmanwar/Documents/style_transfer/test_images’)

 stylized_images = model.stylize(test_images)

model.save(‘newmodel.model’)

model.export_coreml(‘CustomStyleTransfer.mlmodel’)

Here is Jupyter Notebook window for visualization of iterations being performed,

Create ML and Turi Create

 After exporting Core ML model, we can stylize the images using the new model. For that, just type the below lines to the terminal:

stylized_images = model.stylize(test_images)

stylized_images.explore()

Create ML and Turi Create

So, according to this result, we can conclude to the ease of using Turi create, either you’re familiar with Machine Learning or not. That is the main benefit of using Turi Create and to leverage its ability to create our own custom machine learning models that can also be used inside your app by creating .mlmodel from the generic model.

 We should use Turi Create and Create ML to accelerate our development of intelligent apps even though we’re not familiar with Machine Learning so far. This helps us developing intelligent apps for Apple platforms and leverage the additional computing power by offering a smoother experience to users.

 If you’re planning to deliver some complex algorithms and instead of supervised algorithms, then you might look for other options as Turi Create and Create ML only supports Supervised models and they are designed to re-train models, not to build them from scratch.

 

 

 

The following two tabs change content below.
Milan Manwar

Milan Manwar

Senior Software Developer (Mobile) at Dev Information Technology Ltd.
I'm a passionate programmer who is always keen to learn new technologies and latest technology trends. I always prefer to explore new technologies and experiment on its applications and to share the same with people around me.

One thought on “Basics of Create ML and Turi Create

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>