microsoft/Cognitive-Face-iOS

Face Detect APIErrorException: (404) Resource not found

stevenzero37 opened this issue · 1 comments

I did the Azure Face Detect by Python, and I met the issue,

File "C:\ProgramData\Anaconda3\lib\site-packages\azure\cognitiveservices\vision\face\operations_face_operations.py", ###
line 549, in detect_with_url
raise models.APIErrorException(self._deserialize, response)

APIErrorException: (404) Resource not found

There is my code

import asyncio, io, glob, os, sys, time, uuid, requests
from urllib.parse import urlparse
from io import BytesIO
from PIL import Image, ImageDraw
from azure.cognitiveservices.vision.face import FaceClient
from msrest.authentication import CognitiveServicesCredentials
from azure.cognitiveservices.vision.face.models import TrainingStatusType, Person, SnapshotObjectType, OperationStatusType

Set the FACE_SUBSCRIPTION_KEY environment variable with your key as the value.

This key will serve all examples in this document.

KEY = os.environ['FACE_SUBSCRIPTION_KEY']

Set the FACE_ENDPOINT environment variable with the endpoint from your Face service in Azure.

This endpoint will be used in all examples in this quickstart.

ENDPOINT = os.environ['FACE_ENDPOINT']

Create an authenticated FaceClient.

face_client = FaceClient(ENDPOINT, CognitiveServicesCredentials(KEY))

Detect a face in an image that contains a single face

single_face_image_url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Robert_Downey_Jr_2014_Comic_Con_%28cropped%29.jpg/220px-Robert_Downey_Jr_2014_Comic_Con_%28cropped%29.jpg'
single_image_name = os.path.basename(single_face_image_url)
detected_faces = face_client.face.detect_with_url(url=single_face_image_url)
if not detected_faces:
raise Exception('No face detected from image {}'.format(single_image_name))

Display the detected face ID in the first single-face image.

Face IDs are used for comparison to faces (their IDs) detected in other images.

print('Detected face ID from', single_image_name, ':')
for face in detected_faces: print (face.face_id)
print()

Save this ID for use in Find Similar

first_image_face_ID = detected_faces[0].face_id

compile error at
detected_faces = face_client.face.detect_with_url(url=single_face_image_url)

FACE_ENDPOINT is "https://eastasia.api.cognitive.microsoft.com/face/v1.0/detect/"

Do people have ideas about this issue?

I have the same issue, What was the issue please?