Use Custom Vision AI to train you own model using your own images and get results and predictions. Images evaluated through your custom vision model become part of a feedback loop you can use to keep improving your classifier. In this tutorial we are going to build a simple model to recognize Adidas or Nike shoes.
How it works
The Custom Vision service uses a machine learning algorithm to apply labels to images. You can label the images yourself when you upload them to the service. Then the algorithm trains by using this data and calculates the accuracy. Once the algorithm is trained, you can test, retrain, and classify new images. You can also export the model to use offline.
Classification and object detection
Custom Vision has two functions. Image classification, which adds labels to classify an image and Object detection which is similar, but it also returns the coordinates in the image where the label(s) were found.
Prerequisites
You are going to need an Azure Account. If you don’t have an Azure subscription, create a free account before you begin. You can use the Limited Trial for testing your initial model without creating an Azure Account, however the service is retiring and will need to migrate to Azure for bigger quota and limits.
Create a new Custom Vision Project
Login with your Microsoft account in the Custom Vision portal here.
On the menu click to Create a new Project:
Fill out the fields accordingly. Add a new name for the project, add classification for the Project type and General for the domain.
I you don’t have an Azure Account choose the Limited Trial. Otherwise click Create New to create a new Azure Resource Group. Add a name, the Azure Subscription, the Location and the Pricing Tier to Create Resource. Onve you are done, create the Project
Image Datasets
Now that you have created your project you need some images to train the model. There are several ways to find images. You can find complete datasets online, you can search for images on the internet or you can use the Bing Image CLI to download images by using the Bing Search API. To make things easies I have download several images for 2 brands, Nike and Adidas trainer shoes. You can download everything here.
Label the Images
Go back to the portal and click on top to Add Images
Then open the folder with the images and add all Nike images. On the bottom add the label for those labels “nike”. Repeat the same process for the Adidas trainers.
Train and Test
Train the Model by clicking the Train button on top.
In the Performance Tab that follows you can see the model’s accuracy. In this screen you can also see all iteration of the training and assign the default iteration when someone uses the API to make a prediction by clicking on the Make Default button.
Use the Quick Test button to test the results with new images
You are ready! Re-train and test as many times as you need to get satisfying results.
Project Settings and API Keys
To see how to call the API click on the Prediction URL and see the parameters you need to call the API
By clicking the gear icon you can see all the Project Setting.