Apple has released a new thing, CreateML that allows us train a machine learning model to classify images with a couple of lines code.
Creating an Image Classifier Model
An image classifier is a machine learning model that's been trained to recognize images. When you give it an image, it…
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.)
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.
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”.
let builder = MLImageClassifierBuilder()
Then, click the assistant editor and hit the button on the bottom.
You will see ImageClassifier UI.
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.
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.