from azure.cognitiveservices.vision.customvision.prediction import CustomVisionPredictionClient
from msrest.authentication import CognitiveServicesCredentials
endpoint = 'https://####customvision-prediction.cognitiveservices.azure.com'
project_id = '####8db4-66e8-40b3-aa4a-fe3cbb30da35'
prediction_key = '####1670040b44499a8178ffe59be76e'
project_name = '####Test'
credential = CognitiveServicesCredentials(prediction_key)
predict = CustomVisionPredictionClient(endpoint,credential)
with open("./TallowTest1.jpg",mode="rb") as image_data:
tallowresult = predict.detect_image(project_id,project_name,image_data)
我现在已经在Azure中两次创建了CustomVision资源,我想我现在已经拥有了。我同时选择了培训和预测服务。然后转到customvision.ai并创建一个项目。我上传了照片并训练了模型。现在,我正在尝试最简单的Python脚本,但仍然出现错误。最新的是这样的:
...
raise models.CustomVisionErrorException(self._deserialize,response)
azure.cognitiveservices.vision.customvision.prediction.models._models_py3.CustomVisionErrorException: Operation returned an invalid status code 'PermissionDenied'
请注意,我现在完全愿意共享密钥。这只是一个测试,我无法使其正常运行。如果有人会告诉我如何使它工作,我将分享每个密钥。我觉得我已经尝试了键,端点,项目ID的每种组合。而且在不同情况下,我会收到不同的错误消息,但没有任何效果。