Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
This feature is now deprecated. On March 31, 2025, Azure AI Image Analysis 4.0 Custom Image Classification, Custom Object Detection, and Product Recognition preview API will be retired. After this date, API calls to these services will fail.
To maintain a smooth operation of your models, transition to Azure AI Custom Vision, which is now generally available. Custom Vision offers similar functionality to these retiring features.
The fastest way to start using Product Recognition is to use the built-in pretrained AI models. With the Product Recognition API, you can upload a shelf image and get the locations of products and gaps.
Note
The brands shown in the images are not affiliated with Microsoft and do not indicate any form of endorsement of Microsoft or Microsoft products by the brand owners, or an endorsement of the brand owners or their products by Microsoft.
To analyze a shelf image, do the following steps:
Upload the images you'd like to analyze to your blob storage container, and get the absolute URL.
Copy the following curl
command into a text editor.
curl -X PUT -H "Ocp-Apim-Subscription-Key: <subscriptionKey>" -H "Content-Type: application/json" "<endpoint>/computervision/productrecognition/ms-pretrained-product-detection/runs/<your_run_name>?api-version=2023-04-01-preview" -d "{
'url':'<your_url_string>'
}"
Make the following changes in the command where needed:
<subscriptionKey>
with your Vision resource key.<endpoint>
with your Vision resource endpoint. For example: https://YourResourceName.cognitiveservices.azure.com
.<your_run_name>
with your unique test run name for the task queue. It is an async API task queue name for you to be able retrieve the API response later. For example, .../runs/test1?api-version...
<your_url_string>
contents with the blob URL of the imageOpen a command prompt window.
Paste your edited curl
command from the text editor into the command prompt window, and then run the command.
A successful response is returned in JSON. The product recognition API results are returned in a ProductRecognitionResultApiModel
JSON field:
"ProductRecognitionResultApiModel": {
"description": "Results from the product understanding operation.",
"required": [
"gaps",
"imageMetadata",
"products"
],
"type": "object",
"properties": {
"imageMetadata": {
"$ref": "#/definitions/ImageMetadataApiModel"
},
"products": {
"description": "Products detected in the image.",
"type": "array",
"items": {
"$ref": "#/definitions/DetectedObject"
}
},
"gaps": {
"description": "Gaps detected in the image.",
"type": "array",
"items": {
"$ref": "#/definitions/DetectedObject"
}
}
}
}
See the following sections for definitions of each JSON field.
Results from the product recognition operation.
Name | Type | Description | Required |
---|---|---|---|
imageMetadata |
ImageMetadataApiModel | The image metadata information such as height, width and format. | Yes |
products |
DetectedObject | Products detected in the image. | Yes |
gaps |
DetectedObject | Gaps detected in the image. | Yes |
The image metadata information such as height, width and format.
Name | Type | Description | Required |
---|---|---|---|
width |
integer | The width of the image in pixels. | Yes |
height |
integer | The height of the image in pixels. | Yes |
Describes a detected object in an image.
Name | Type | Description | Required |
---|---|---|---|
id |
string | ID of the detected object. | No |
boundingBox |
BoundingBox | A bounding box for an area inside an image. | Yes |
tags |
TagsApiModel | Classification confidences of the detected object. | Yes |
A bounding box for an area inside an image.
Name | Type | Description | Required |
---|---|---|---|
x |
integer | Left-coordinate of the top left point of the area, in pixels. | Yes |
y |
integer | Top-coordinate of the top left point of the area, in pixels. | Yes |
w |
integer | Width measured from the top-left point of the area, in pixels. | Yes |
h |
integer | Height measured from the top-left point of the area, in pixels. | Yes |
Describes the image classification confidence of a label.
Name | Type | Description | Required |
---|---|---|---|
confidence |
float | Confidence of the classification prediction. | Yes |
name |
string | Label of the classification prediction. | Yes |
In this guide, you learned how to make a basic analysis call using the pretrained Product Recognition REST API. Next, learn how to use a custom Product Recognition model to better meet your business needs.
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!