I used this project from github: https://github.com/jernejk/RealTimeFaceApi , but the result always show "Getting identity failed."
My key and endpoint is correct, but I'm not sure the value of "FaceGroupId" is meaning persongroupId?(I use personGroupId here.)
I want to know whether the mistake exist in previous steps?
The following code show the 3 place need user to change:
public static class Program
{
// TODO: Add Face API subscription key.
private static string FaceSubscriptionKey = "myFaceAPIkey";
// TODO: Add face group ID.
private static string FaceGroupId = "XXX";//I use persongroupId here.
private static readonly Scalar _faceColorBrush = new Scalar(0, 0, 255);
private static FaceClient _faceClient;
private static Task _faceRecognitionTask = null;
public static void Main(string[] args)
{
_faceClient = new FaceClient(new ApiKeyServiceClientCredentials(FaceSubscriptionKey))
{
Endpoint = "https://myendpoint.cognitiveservices.azure.com/face/v1.0"
};
string filename = args.FirstOrDefault();
Run(filename);
}
I run that project on my side successfully. Yes, the FaceGroupId
should be the persongroupId
that you created in your face API service. And the reason that you get error : Getting identity failed.
is there is something wrong with your Endpoint
value in _faceClient
, The value here should be :
https://<yourEndpoint>.cognitiveservices.azure.com
Will be ok. There is one thing that you should know if you use recognition model 02 to create and train your person groups, pls modify the code in Program.cs
from:
var detectedFaces = await _faceClient.Face.DetectWithStreamAsync(stream, true, true);
to :
var detectedFaces = await _faceClient.Face.DetectWithStreamAsync(stream,true,true,null, "recognition_02");
If you are using recognition model 01 , there is no need to change(I use 02 model on my side).
Hope it helps .