我学习机器学习。我正在构建一个具有azure认知服务视觉人脸的应用程序,我有一个问题,如下图所示(APIErrorException:(404(找不到资源(。我该怎么修?谢谢,很抱歉,因为我的英语很差。在这里输入图片描述
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
看起来您错过了后面的斜杠和端点的末尾,如下所示;
EndPoint:https://westus.api.cognitive.microsoft.com/face/v1.0;
尝试将其更改为:
Modified : EndPoint:https://westus.api.cognitive.microsoft.com/face/v1.0/;
附加参考;
https://learn.microsoft.com/en-us/azure/cognitive-services/face/quickstarts/python-sdkhttps://github.com/Microsoft/Cognitive-Face-iOS/issues/37
希望能有所帮助。