Skip to content

'NotFoundIteration' Error when Calling DetectImage() for Object detection 'CustomVisionPredictionClient' #210

@ShamineDsouza

Description

@ShamineDsouza

Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction.Models.CustomVisionErrorException: 'Operation returned an invalid status code 'NotFound''
Error : Detail
| Body | {Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction.Models.CustomVisionError} | Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction.Models.CustomVisionError
  | Code | "NotFoundIteration" | string
  | Message | "Invalid iteration" | string

Above is the error , I am getting when running to test the prediction model.
Error is returned on this line of code
var result = predictionApi.DetectImage(project.Id, lstIteration[0].Name, stream);

Sample Code :

private void TestIteration(CustomVisionPredictionClient predictionApi, Project project, IList lstIteration)
{
var imageFile = Server.MapPath("~/" + imgPath);
using (var stream = File.OpenRead(imageFile))
{
var result = predictionApi.DetectImage(project.Id, lstIteration[0].Name, stream);
foreach (var c in result.Predictions)
{
Console.WriteLine($"\t{c.TagName}: {c.Probability:P1} [ {c.BoundingBox.Left}, {c.BoundingBox.Top}, {c.BoundingBox.Width}, {c.BoundingBox.Height} ]");
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions