Open ShamineDsouza opened 3 years ago
what was the issue? getting a similar issue
The iteration number mentioned is not correct. Check the iteration number in custom model, on which it is trained . The iteration number changes every time it is trained / predicted.
Eg: Iteration1 --> Iteration2
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} ]");
}
}
}