CustomVisionQuickstart.py uses wrong endpoint for predictor client config
还没有人认领这个 Issue。
评估
调研方向
打开 cognitive-services-quickstart-code/python/CustomVision/ObjectDetection/CustomVisionQuickstart.py,并将其 predictor client 配置与 issue 中显示的单独 prediction endpoint 和 key 进行比较。使用列出的 resource 值运行 object-detection quickstart,并确认检测返回结果而不是 Unauthorized。检查链接的 image-classification 和 object-detection 文档,确认其中的配置指导是否一致。
由索引模型根据 Issue 内容生成。
描述
Please provide us with the following information:
This issue is for a: (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
Run "cognitive-services-quickstart-code/python/CustomVision/ObjectDetection/CustomVisionQuickstart.py" with following info:
ENDPOINT = "TRAINING_RESOURCE_ENDPOINT"
training_key = "TRAINING_RESOURCE_API_KEY"
prediction_key = "PREDICTION_API_KEY"
prediction_resource_id = "PREDICTION_RESOURCE_ID"
Any log messages given by the failure
CustomVisionErrorException Traceback (most recent call last)
Input In [29], in <module>
1 with open(os.path.join (base_image_location, "test", "test_image.jpg"), mode="rb") as test_data:
----> 2 results = predictor.detect_image(project.id, publish_iteration_name, test_data)
File c:\...\venv\lib\site-packages\azure\cognitiveservices\vision\customvision\prediction\operations\_custom_vision_prediction_client_operations.py:358, in CustomVisionPredictionClientOperationsMixin.detect_image(self, project_id, published_name, image_data, application, custom_headers, raw, **operation_config)
355 response = self._client.send(request, stream=False, **operation_config)
357 if response.status_code not in [200]:
--> 358 raise models.CustomVisionErrorException(self._deserialize, response)
360 deserialized = None
361 if response.status_code == 200:
CustomVisionErrorException: Operation returned an invalid status code 'Unauthorized'
Expected/desired behavior
Returned results
OS and Version?
Windows 11 Enterprise
Versions
21H2
Mention any other details that might be useful
Fixed by changing the following:
TRAINING_ENDPOINT = "TRAINING_RESOURCE_ENDPOINT"
training_key = "TRAINING_RESOURCE_API_KEY"
PREDICTION_ENDPOINT = "PREDICTION_RESOURCE_ENDPOINT"
prediction_key = "PREDICTION_API_KEY"
prediction_resource_id = "PREDICTION_RESOURCE_ID"
credentials = ApiKeyCredentials(in_headers={"Training-key": training_key})
trainer = CustomVisionTrainingClient(TRAINING_ENDPOINT, credentials)
prediction_credentials = ApiKeyCredentials(in_headers={"Prediction-key": prediction_key})
predictor = CustomVisionPredictionClient(PREDICTION_ENDPOINT, prediction_credentials)
Be sure to update docs if this is indeed an issue:
- 主要语言
- Jupyter Notebook
- 星标
- 388
- 派生
- 555
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure-Samples/cognitive-services-quickstart-code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 25/100
Azure-Samples/cognitive-services-quickstart-code#346 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 30/100
-
难度 3/5 1-2 天 新手友好度 25/100
查看 Azure-Samples/cognitive-services-quickstart-code 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
hierynomus/sshj#1070 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
-
Resource links written as host:port without a scheme are broken可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 70/100
nearform/lastlight#452 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复