Lab 1 - Computer Vision
Analyze an image by sending it to the Computer Vision API
Last updated
Was this helpful?
Analyze an image by sending it to the Computer Vision API
Last updated
Was this helpful?
Microsoft Azure Cognitive Services contain some pre-built models for the most typical tasks, such as object detection in pictures, speech recognition and synthesis, sentiment analysis and so on. Let us test the service to see if it can recognize some specific objects in one particular problem domain.
Suppose we need to create an application that recognizes Simpson Lego Figures:
We will use the from Henk Boelman.
Let us start by looking at how pre-trained can see our images:
The Computer Vision Endpoint must be created inside a resource group. You can use an existing resource group or create a new one. To create a new resource group, use the following command. Replace <<resource-group-name>> with your name to use for this resource group. Replace <<location>> with the Azure region to use for this resource group.
Run the command below to create a free Computer Vision Endpoint. Replace <<resource-group-name>> with the name you used above and use the same location. Replace <<name>> with a name for your resource like: my-computervision.
To get the endpoint from the Cognitive service account run the CLI command below. Replace <<name>> and <<resource-group-name>> with the names used above.
Get the API keys
Get the endpoint URL
- An endpoint URL looking like this: https://<region>.api.cognitive.microsoft.com/ - 2 keys looking like this: 06a611d19f4f4a88a03f3b552a5d2379
Run the command below to test the endpoint for an image with Bart Simpson on it.
The response should look like:
{
"description":{
"tags":[ "text", "indoor", "toy" ],
"captions":[ {
"text": "a hand holding a toy",
"confidence":0.4660031199455261
}]}}
Tip: Try it with your own images!
In this lab you have created a Computer Vision Endpoint in Azure and send images to the endpoint using the command line and a through a visual interface.
While some of the objects (such as Toy) can be recognized by the pre-trained model, more specialized objects (like this is Bart Simpson or Marge Simpson) are not determined correctly.
Navigate to: Enter the endpoint URL, the API key, a link to an image and click 'analyze image'. This website shows all the information that comes back from the Computer Vision API.