Introduction & Overview
Creating Custom Vision Resources and Models
Consuming and Exporting Models
This course explores the Azure Custom Vision service and how you can use it to create and customize vision recognition solutions. You'll get some background info on what the service is before looking at the various steps for creating image classification and object detection models, uploading and tagging images, and then training and deploying your models.
- Use the Custom Vision portal to create new Vision models
- Create both Classification and Object Detection models
- Upload and tag images according to your requirements
- Train and deploy the configured models
- Developers or architects who want to learn how to use Azure Custom Vision to tailor a vision recognition solution to their needs
To get the most out of this course, you should have:
- Basic Azure experience, at least with topics such as subscriptions and resource groups
- Basic knowledge of Azure Cognitive Services, especially vision-related services
- Some developer experience, including familiarity with terms such as REST API and SDK
In the last demo, we published our models to a REST endpoint, so now it's time to test it. Microsoft made it really simple to do this: you just need to go to the API documentation page itself, and fill in information that you get directly from the Custom Vision Portal.
Let me switch to this other tab, which is the home page of Custom Vision on docs.microsoft.com. If I expand Reference here on the list, I have the documentation for both the training and the prediction APIs. Let's right-click here on the Prediction API first, and then click to open it in a new tab. Then I'll switch to it.
Let's see what we can find here: On the left side of the screen, I can switch between the various HTTP verbs available, such as GETs and POSTs. For example, ClassifyImageURL performs image classification on an image sent by an URL. Then, on the main screen, we have a list of all Azure Datacenters where Custom Vision is available for prediction.
A bit down the page, I have information related to how to construct my request URL, including parameters and request headers. Finally, scrolling down a bit more, we have a few possible response codes depending on the situation. In an ideal world, you're looking to get a response 200, which means you're successful! You can also see a sample json result for this query. You can get a prediction directly from your model by using this page. Let me show you.
First, I'll switch to ClassifyImageURL, as I want to get a picture from the internet. Then I'll click here on Southeast Asia at the top, as this is the Datacenter where I created my Azure resource. On the new page that opens, after a few seconds, I can see all the required and optional parameters that I need to fulfill to perform a prediction call. I'll click here on the Name field, and switch to your resource name, as this is the new way to connect to a Custom Vision resource on Azure. The name of my resource, as you can remember from the first demo, is "CACustomVision-prediction". The next field is the Project ID, so let's switch to the Custom Vision Portal, click here on the gear at the top-right, and select and copy this project ID here on the left. Then I'll switch back to the previous page, and paste that in the proper field.
In the next field is asking me for the published name of the iteration, so let's put the name we gave on the last demo, "Latest", here. The Application parameter, as you can see, is optional, so I'll just click here to remove it. Now I need to add my prediction key, so I'll switch back to Custom Vision, move to the Performance tab, click on the Prediction URL button, and copy this prediction key, notice that it's the same key for both files and URLs. I'll then switch back to the API test page, and paste the key in the proper field.
The last thing I need to do is to add on the json request body the link to a picture of the Empire State building, and for convenience, I'll use the same one I had used before from Wikipedia. Notice that, as I build the information on this page, the URL field automatically updates with new information, which allows me to copy this built URL to other applications, as needed.
Let's test this! I'll click on the send button, and here's my Json file with the response, saying that this image is indeed of the Empire State Building. Finally, let's export this model to one of the Edge formats. To do that, let's go back to Custom Vision, close this dialog box, and notice that the option to Export the model is currently disabled. That's because, in order to export a model, you need to be using one of the compact domains.
Let's click on the gear, and down here on the left, let's click the option to change this to Landmarks Compact. The "Export Capabilities" option opens, but as I don't want to use the Vision AI Dev Kit, I don't need to change anything, so let's just click on "Save Changes". I'll now go back to the Performance tab, and the button is still not available, but that's just because I need to re-train the model. I'll click on the Train button, then on Quick Training, and after a few seconds, a new iteration is created. Notice that this one has a lower Precision, Recall and AP. However, this is not as bad as it looks: remember that we are using very few images, so any picture that doesn't get correctly identified will have a big impact on the results.
But now our Export button is available, so let's click on it, and here we have all the options for exporting the model. I'll select TensorFlow, and here we have several options, such as the TensorFlowJS, TensorFlow Lite, and so on. But let me use the default option, and click on Export. After a few seconds, I'll click on the download button, and will be able to download to my computer.
From here, you can just give this file to an Android developer, and he will be able to perform predictions locally on an Android device, directly from the app.
Emilio Melo has been involved in IT projects in over 15 countries, with roles ranging across support, consultancy, teaching, project and department management, and sales—mostly focused on Microsoft software. After 15 years of on-premises experience in infrastructure, data, and collaboration, he became fascinated by Cloud technologies and the incredible transformation potential it brings. His passion outside work is to travel and discover the wonderful things this world has to offer.