cognitive-services-python-sdk-samples: Object detection( Prediction ) AttributeError: 'CustomVisionPredictionClient' object has no attribute 'predict_image'

Hello,

I´m trying to connect my object detection project to my host application, and I’ve already trained my Model, and I have the iteration id and project ID. I would just like to use the prediction code in my application, I tried to do the same code found here which is :

! pip install azure-cognitiveservices-vision-customvision
from azure.cognitiveservices.vision.customvision.prediction import CustomVisionPredictionClient

my_project_id = "Project Id from the settings page" 
prediction_key = "Prediction Key from the settings page"

ENDPOINT = "https://southcentralus.api.cognitive.microsoft.com"
predictor = CustomVisionPredictionClient(prediction_key, endpoint=ENDPOINT)
my_iteration_id = "iteration id from portal"

with open("Swimming/14.jpg", mode="rb") as test_data:
    results = predictor.predict_image(my_project_id, test_data, iteration_id=my_iteration_id)

but, I still receiving this error :

Traceback (most recent call last): File “cazurecloud.py”, line 22, in <module> results = predictor.predict_image(my_project_id, test_data, iteration_id=my_iteration_id) AttributeError: ‘CustomVisionPredictionClient’ object has no attribute ‘predict_image’

Any Help, please !

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Thank you - I will try to reproduce that and see what might cause it.

Hi @mrsalhaoui, thank you for the detailed screenshot and I am sorry to hear that didn’t resolve the issue. I will continue investigating and will try to reproduce those errors you are getting.