首页 > 解决方案 > 使用 microsoft api 构建应用程序

问题描述

我学习机器学习。我正在使用 azure-cognitiveservices-vision-face 构建一个应用程序,但我遇到了如下图所示的问题(APIErrorException: (404) Resource not found)。我该如何解决?谢谢和抱歉,因为我的英语很差。在此处输入图像描述

    APIErrorException                         Traceback (most recent call last)
<ipython-input-38-889e8e1c61a7> in <module>()
      1 single_face_image_url = 'https://www.biography.com/.image/t_share/MTQ1MzAyNzYzOTgxNTE0NTEz/john-f-kennedy---mini-biography.jpg'
      2 single_image_name = os.path.basename(single_face_image_url)
----> 3 detected_faces = face_client.face.detect_with_url(url=single_face_image_url)
      4 if not detected_faces:
      5     raise Exception('No face detected from image {}'.format(single_image_name))

/usr/local/lib/python3.6/dist-packages/azure/cognitiveservices/vision/face/operations/_face_operations.py in detect_with_url(self, url, return_face_id, return_face_landmarks, return_face_attributes, recognition_model, return_recognition_model, detection_model, custom_headers, raw, **operation_config)
    547 
    548         if response.status_code not in [200]:
--> 549             raise models.APIErrorException(self._deserialize, response)
    550 
    551         deserialized = None

APIErrorException: (404) Resource not found

标签: pythonazure-cognitive-services

解决方案


看起来您错过了尾随斜杠和端点末尾,如下所示;

EndPoint:https://westus.api.cognitive.microsoft.com/face/v1.0;

尝试将其更改为:

Modified : EndPoint:https://westus.api.cognitive.microsoft.com/face/v1.0/;

附加参考;

https://docs.microsoft.com/en-us/azure/cognitive-services/face/quickstarts/python-sdk https://github.com/Microsoft/Cognitive-Face-iOS/issues/37

希望能帮助到你。


推荐阅读