Azure Custom Vision - Testing the Prediction URL


Microsoft Azure

In part one of the series, I demonstrated how to build an Azure Custom Vision classification model and test using the Custom Vision portal, in this second part I’m going to show you how to test the Prediction URL with the Postman ReST client.

The Postman ReST client is an essential tool when working with Restful API’s, if you haven’t used Postman before you can download it from here: https://www.getpostman.com/apps

Once you have Postman installed your ready start, open an internet browser and go to http://customvision.ai and click SIGN IN.

Login with the same account you used in Part 1. After logging in you will be presented with the Projects page, click on the project which you created in Part 1.

Once the project opens, click on the “Performance” link from the navigation bar to open the Performance page.

From the Performance page, click on the “Prediction URL” link located under the navigation bar, the “How to use the Prediction API” modal will now open. The modal has details of how to connect to the API including the URL, Header and Body information. We are going to be using the details located under “If you have an image file:” in the Postman ReST client.

Copy the URL from the “How to use the Prediction API” modal, then open the Postman ReST client, change the request type from GET to POST and paste the URL, next copy the header parameters “Prediction-Key” and “Content-Type” along with their corresponding values and paste these into the Postman ReST client.

Now click on the “Body” tab within Postman, set the type to “Binary”, then click on choose file and browse to an image file that can be used to test the model.   

Now click on the “Send” button and the view the response, in the example below the model returned a Probability of 100% Occupied and a Probability of 0% Vacant.

You can also use the “Predictions” page in the Custom Vision portal to view the prediction as well.

Thanks for reading the blog and look out for Part 3 in the series, where I will show you how to use the Azure Custom Vision model in Azure IoT Edge.

Posted by Nathan Gaskill