I was following this documentation for using the Microsoft Face API to identify faces in an image in Visual Studio when I got the following error printed in the Console:
Error adding Person to Group Exception of type 'Microsoft.ProjectOxford.Face.FaceAPIException' was thrown.
The exception is printed when the following function to add a person to an existing person group is called:
public async void AddPersonToGroup(string personGroupId, string name, string pathImage){
try{
await faceServiceClient.GetPersonGroupAsync(personGroupId);
CreatePersonResult person = await faceServiceClient.CreatePersonAsync(personGroupId, name);
foreach (var imgPath in Directory.GetFiles(pathImage, "*.jpg")) {
using (Stream s = File.OpenRead(imgPath)) {
await faceServiceClient.AddPersonFaceAsync(personGroupId, person.PersonId, s);
}
}
} catch (Exception ex){
//Below is where the error was printed.
Console.WriteLine("Error adding Person to Group " + ex.Message);
}
}
This is how I am calling AddPersonToGroup in the main method:
new Program().AddPersonToGroup("actor", "Tom Cruise", @"C:\Users\ishaa\Documents\Face_Pictures\Tom_Cruise\");
I tried searching up this error in Google and came across this SO question, but that answer did not work for me. (Their answer was to pass in the subscription key and endpoint for the FaceServiceClient constructor.)
Would anyone be able to provide any insight into why this error is occurring? I have been unable to figure out what is causing it, but I believe it may have to do with
await faceServiceClient.GetPersonGroupAsync(personGroupId);. I also read that it may be due to the Cognitive Services pricing plan I have chosen. However, the free one which I am using allows for 20 transactions per minute and I am only trying to add 9 pictures for 3 different people.
Activity logdoes not seem to contain it? - Ishaan Javaliexobject - Nicolas R