Custom Vision AI - Building Your Own Custom Model And Train

Here in this article, we are going to use the Microsoft Custom Vision AI, which is a cognitive AI service. The Custom Vision service uses the machine learning to classify the images we are uploading. The only thing we are required to do is, just specifying the correct tag for each image, you can also tag thousands of images at a time. The AI algorithm is super powerful to give us better accuracy and once the model is trained, use the same to classify new images according to the needs of your app.

Introduction

The Cognitive Services are always a great topic to consider for writing, especially when there is a mix of Machine Learning. Here, in this article, we are going to use Microsoft Custom Vision AI, a cognitive AI service. With the help of Custom Vision AI, we can easily do the below things.

  1. Upload image
  2. Tag the images
  3. Train the model
  4. Evaluate the result

The Custom Vision Service uses machine learning to classify the images we are uploading. The only thing we are required to do is, just specifying the correct tag for each image. You can also tag thousands of images at a time. The AI algorithm is super powerful to give us better accuracy and once the model is trained, we can use the same to classify new images according to the needs of our app. Let’s skip the introduction and start doing some amazing things. You can always see this article on my blog here

Background

I have a habit of writing an article about the things I learn. Though I had worked with Cognitive Services before, recently I had a chance to work with Custom Vision AI service, so I  thought of building something with that. Here, in this article, we are going to create an Azure Custom Vision AI which can,

  • Scan for real objects
  • Identify whether the object is a car or not
  • If that is a car, then check which is the car manufacturer

We will be creating a Custom Vision AI model, which we will train with thousands of images. I hope it helps.

Prerequisites

To do the wonderful things, we always need some prerequisites.

  1. Account with Custom Vision AI; you can either use the free subscription or your Azure account
  2. A database of images for training the model; the same can be downloaded from here
  3. Good internet connection; you will have to upload thousands of images
  4. I have already collected a large dataset which is more than enough to get started; you can download it from OneDrive here

Creating Your Custom Vision AI Model

I assume you have already gone through and set up all the prerequisites and followed the instructions. If not, please check again.

To get started here, please visit https://customvision.ai/ and,

  1. Log in with your credentials
  2. Create your project
  3. Add as many relevant images as possible and tag them appropriately
  4. Once you tag them properly, you can train your model. If everything goes well, you should see an output as below.
Custom Vision AI - Building Your Own Custom Model and Train
Custom Vision AI Train Output

Please make sure that you are checking the precision. If it is a good number, then you are good to go. As many images as you can upload and train with the correct tag, the precision value gets increased. So, feel free to add images and see the output yourself. Below is the count of the images which I trained to my model.

Custom Vision AI - Building Your Own Custom Model and Train 

When you train again with the new data, you can see that a new iteration is getting created which is really handy if you need to go back to the previous state if the precision value is getting decreased.

You can also do a quick test with the UI provided. Please click on the Quick Test button and upload an image. Let’s upload an image of a bedroom.

Custom Vision AI - Building Your Own Custom Model and Train 
Bedroom Test

Well, that was easy. Now, let’s upload an image of a Porsche car.

Custom Vision AI - Building Your Own Custom Model and Train 
Porsche Car Result

Have you noticed the values returned? The Custom Vision API is saying that the image is 99.8% is a car and 99.3% is a Porsche car, which is really impressive. Now, what about BMW?

Custom Vision AI - Building Your Own Custom Model and Train 
BMW Result

Our Custom Vision AI is working as expected. Now, we can go ahead and grab our keys that are needed to create an application to use Custom Vision AI. Please click on the Settings symbol on the right side of the page, and note down your project id and prediction key. You will also need a prediction URL, which you can get from the Performance tab.

Conclusion

The possibilities of Cognitive Services and machine learning are limitless. You can think of using this in many of your real-life scenarios. If possible, please share me your thoughts about all the places we can use this Custom Vision AI service at. In this article, we have learned,

  • What Custom Vision AI Service is
  • How to work with Custom Vision AI service
  • How to train and test our Custom Vision AI model

Is that all? No, in the next article, we will create an application which can be used to test it in real time.

Your turn. What do you think?

Thanks a lot for reading. Did I miss anything that you think should have been in this article? Did you find this post useful? Do not forget to share your feedback. What are you waiting for? Create your model and train.