During Consuming Cognitive Services in Xamarin session at Developing Intelligent Apps meetup, I demonstrated how use the Face API to verify if two faces belongs to the same person. Here’s a quick recap of how the API works:
After the session,a really interesting post showed up on the Meetup page:
How would the Face API react to pictures of the same person, but at different ages? Something I did not explore yet. So I went on and did some experimentation. As usual, pooled my pictures from the web to get a wide variety, and found the perfect source of pictures:
All the requests to the API were done from Postman, and I additionally requested the gender, age and emotion in the Detect request so we can get a sense of what API is “seeing”. Here’s some of the results, starting off with our favourite:
Verification result: The two faces belong to different people with a confidence score of 0.38774.
Verification result: The two faces belong to the same person with a confidence score of 0.50165.
Verification result: The two faces belong to different people with a confidence score of 0.41263.
Verification result: The two faces belong to the same person with a confidence score of 0.50261.
Verification result: The two faces belong to different people with a confidence score of 0.41276.
Arwin Neil Baichoo
Verification result: The two faces belong to different people with a confidence score of 0.36693.
Just in case you’re wondering who’s that last celebrity, well that’s me , 15 years ago and me now. This is one of the largest age gaps among all my comparisons, with a confidence score of 0.36693. Let’s see what that really means. Here’s the term confidence as how the Face API reference defines it:
A number indicates the similarity confidence of whether two faces belong to the same person, or whether the face belongs to the person. By default, isIdentical is set to True if similarity confidence is greater than or equal to 0.5. This is useful for advanced users to override “isIdentical” and fine-tune the result on their own data.
For all the results above ,whether the face belongs to the same person or not relies on the whether isIdentical is True or False in the Verify JSON Response. That also holds for the demo on the API’s website. But if we look a bit further and consider the confidence scores, we see that on average, the API is around 42% sure that the two persons are the same,when there is an age gap . Considering that doing this experiment, we have knowledge of an age gap being present, and that the face API is good enough to give obvious bad comparisons like below a flat 0 confidence score (go ahead, try it out!) :
42 percent is not bad at all. I believe it’s safe to say that yes, to some extent, the Face API is able to recognise persons over significant age gaps if you’re fine with overriding the “IsIdentical” value and base yourself on a 40-ish percent of confidence (or any more appropriate value) to draw your conclusion.