Build a Simple ImageClassifier with Kanye & Kim Part1
Apple has released a new thing, CreateML that allows us train a machine learning model to classify images with a couple of lines code.
Setup
For setting up the environment, we need Apple Dev account(actually, some people offers a tool for free, but I don’t recommend that because that isn’t from Apple.)
1.macOS 10.14(Beta)
2.Xcode 10(Beta)
As you noticed, they are beta version which means there are some risks. Actually, the Anti Virus software I’m using doesn’t work on OS 10.14.
Xcode 10
https://developer.apple.com/xcode/
Create a playground
Open Xcode beta and create a new project then choose blank.

When you open the project, you can see the following. If you click the button on the bottom, you will see “Hello, playground”.

Write code
import CreateMLUI
let builder = MLImageClassifierBuilder()
builder.showInLiveView()
Then, click the assistant editor and hit the button on the bottom.


You will see ImageClassifier UI.
Prepare Images
For training a model you need to collect images. In this case, I used Kanye and Kim. According to the article, we need 10 images at least. I collected 55 images manually. 45 for train and 10 for test.

Train image
Once you get image, what you need to do is drag and drop the train folder then wait a few minutes. In my case, it took 2 minutes (MacBookPro Late 2013 4GB Ram).
When you finish training, you need to drag & drop the test folder as well as the train folder.
Save the model
Finally, you can save the model. For doing that, you need to click “save” button.
The next article will be how to use the model we trained.