How to train custom image classifier in 5 minutes

avatar
David Rajnoch
8. July 2017

Recognize images using Ximilar Recognition API

Today I will show how to set and test custom image classification engine using Ximilar Recognition (formerly known as Vize.ai — Custom image classification API). We will prepare dataset, upload images, train classifier and test our classifier in the web interface. We need no coding experience unless we want to build API in our project. Let’s start now.

Prepare dataset

We want classifier to recognize cat vs dog. First, we will need 20 images of each cat and dog. Let’s google “cat” and “dog” and save 20 images of each. For every category I also searched for different breed so my dataset is as diverse as possible.

Upload dataset to Ximilar App

We will need to create an account through app.ximilar.com or vize.ai. Visit the homepage then click “Log in” and create account through Sign Up form. Then you can login to the platform. Select Image Recognition service on the dashboard page.

We are ready to create a new task. A task is classification engine (convolutional network model) that lets us classify our images. On the Overview page, through the Quick Actions section we click on “Add Task” button and pick Categorization task. Fill name of our classifier “Cat vs Dog”. We want to add two categories “Cat” and “Dog”. We can always add and delete category later. Click “Create New” to add category on Task page. We create two of them.

Now, we are going to “Drag and Drop” images to each category.  In Category drag images and drop them into Drag & Drop section. We can see 20 and 20 images uploaded on the image above. Ximilar Recognition service requires that every label has at least 20 images. We can use “Manage Category” button on Label/Category to show images and move them from one category to another.

Train classifier

In this step, we can review our categories. We are ready to click on “TRAIN” button.

A task is in training right now. It can take one to five hours depending on the number of images and complexity of your task. Ximilar Recognition (Vize) uses transfer learning and set of fine-tuned model architectures to reach the best possible accuracy on each task. Time to have a coffee now and wait for training to finish. After task training is finished you will see in the model section below list of trained models:

Test classifier

Our model is ready! We reached 94% accuracy on our 40 images dataset. You can view more statistics about trained model when you click on DETAIL button. We can now test it using Classify preview.

Summary

We trained and tested our classifier using Ximilar web interface. This is the most simple way to build image classification engine. We reached 94% accuracy which we can increase to 100% with uploading more images. It is time to experiment with huge possibilities that image classification brings. In developers documentation we can also find sample code to implement REST API into our app.

What kind of application can we build using visual AI? Let me know about your ideas in comments.

Related Articles