How to connect Prediction ID and Image ID in Azure CustomVision

187 Views Asked by At

I'm trying to dig through the CustomVision Python SDK and can't find a way to get the ID of an image from a prediction ID. The goal is to be able to tag images after were sent through the classify_image function of the prediction client, not during. Classify_image returns ImagePrediction objects with prediction IDs, and I need a way to tag that image using the prediction ID.

1

There are 1 best solutions below

3
On

You can use "Query predictions" method from the "Training API" (not the prediction one) of Custom Vision.

See method documentation here: https://westeurope.dev.cognitive.microsoft.com/docs/services/Custom_Vision_Training_3.3/operations/5eb0bcc7548b571998fdded8

With this method, you can get the predictions realized on a specific iteration of a project (using time filtering also), then you can filter the results using the image ID because the response format is the following:

output sample

Use results "id" field to filter