Azure Face API - Invalid Request + JSON parsing error

Johann Lau 0 Reputation points
2023-02-09T15:49:46.4633333+00:00
Firstly, I am disappointed with Azure’s inconsistency with limited access. On one of your Learn articles, it was stated that only the Identify and Verify features required registration. However, on another article, it was stated that the entire Face service is only available to Microsoft managed customers and partners. It is unclear which of the policies is true.
	Secondly, an unexpected status occurred while I ran the following code:

import requests

BASE_URL = "https://crowdmanagement-face.cognitiveservices.azure.com/face/v1.0/detect"

HEADERS = {
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': "[My Key]"
}

PARAMS = {
    'returnFaceLandmarks': 'true',
    'returnFaceId': 'true',
    'detectionModel': 'detection_03',
}

url = "https://u.cubeupload.com/Johann/test1.jpg"

data = {'url': url}

r = requests.post(BASE_URL, data=data, headers=HEADERS, params=PARAMS)

print(r.json())

	While I expected that the code returned JSON containing face information, I received the following error:

{'error': {'code': 'InvalidRequest', 'message': 'Invalid request has been sent.', 'innererror': {'code': 'UnsupportedFeature', 'message': 'Feature is not supported, missing approval for one or more of the following features: Identification,Verification. Please apply for access at https://aka.ms/facerecognition'}}}

	As such, I attempted to set the 'returnFaceId' attribute to 'true'. I was further disappointed seeing a second error:

{'error': {'code': 'BadArgument', 'message': 'JSON parsing error.'}}
Azure Face
Azure Face
An Azure service that provides artificial intelligence algorithms that detect, recognize, and analyze human faces in images.
165 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 52,686 Reputation points
    2023-02-13T23:30:05.69+00:00

    Hello Johann Lau

    Thanks for reaching out to us. For the Face API, only face detection with parameter returnFaceId=false doesn't require approval, FaceId is part of Face Recognition and Face Identify. In your code, you put returnFaceId=true

    If after fixing the code, you still see errors, please kindly share the code sample you are following so that we can reproduce your error. I hope you can understand, when you ask for FaceID, Face Identify need to be run to get a ID.

    May I know which article you are mentioning for the inconsistency?

    In the public document, it mentions below - https://learn.microsoft.com/en-us/legal/cognitive-services/computer-vision/limited-access-identity?context=%2Fazure%2Fcognitive-services%2Fcomputer-vision%2Fcontext%2Fcontext#registration-process

    Customers and partners who wish to use Limited Access features of the Face API, including Face identification and Face verification, are required to register for access by submitting a registration form. The Face Detection operation is available without registration.

    In the Q&A page, it lists those features need access - https://learn.microsoft.com/en-us/azure/cognitive-services/cognitive-services-limited-access#list-of-limited-access-services

    User's image

    I hope this helps.

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.