Azure is pretty amazing. It has services for almost everything.

And did you know that Azure even has the ability to recognize faces?

Azure Face is a pretty fantastic facial recognition service. Ten years ago, it would have seemed almost magical. But today, you can recognize faces in images using a cloud service with very little code on your end.

First off, Microsoft has a great demo web page where you can experiment without writing any code.

If you want to try it out yourself, you can upload a photo on their demo page. Azure will find the face inside of the picture. Merely finding a face doesn’t seem that important, but if we are doing some manual tagging, the ability to tag those faces is essential.

In this case, it detected Doug’s face.

This quickly leads into a Face Verification demo, which you can also demo online. For this one, I uploaded two photos of Doug, and it confirmed that Doug is probably Doug.

Now the final, and the most humorous, concept is emotional recognition. Azure Face can determine the emotional state of the person in a picture. With our first photo of Doug, you can see he is mostly neutral, with a hint of surprise. 😊

So how can we achieve this using our own code? We will need to start with a new console application project in Visual Studio. Once you have that, we need to create an Azure Face Key.

Yes, the UI says, “Create Face”.

Next, we need to get our API keys for this service.

Now we can scan an image and see if we get a face. This API will tell us if it finds faces in the image (and wherein the image). The code below finds three faces in an image.

In our next post, we will use Azure Face to compare faces. Is a Doug really our Doug?

Share This