Identify faces using Face API in Microsoft Cognitive Services
In this article, I'm going to guide you how to work with the Face API in Microsoft Cognitive Services. This uses more advanced face algorithms. So now no need to build advanced machine learning algorithms to detect faces in an image and identify the people on the images.
So this has two main functions which are face detection with attributes and face recognition.
Face Detection
You can detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes. In here you just need to pass the image URL as the requested content.
So this will return face landmarks and face attributes as return values. As the face landmarks, it can have face landmark attribute points such as: eye point, nose point, and eye brows point. And as in the face attributes, it can have age, gender, smile, emotions, hair, makeup, glasses and etc.
A part of a sample result will show below
So for this, I have made a sample console application using .Net which prints the attributes in the console. And you can use this for curl, Java, Javascript, Php, Python. The sample code lines also available for them in here: https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236
Here is the link for the GitHub sample: Github FaceDetection
In the GitHub repo, you need to add a subscription key. For that, you can have a trial subscription keys from here: https://azure.microsoft.com/en-gb/try/cognitive-services/?api=face-api
Face Recognition
Actually, this is a highly needed scenario in the current world as the aspect of the security. This has four main functions, which are face verification, finding similar faces, face grouping, and person identification.
In the finding similar faces, it can compare against two detected faces in two pictures. This can try out from here: try out
The main part is face verification with person identification. For that it has a step by step process.
- Get a Face API key (trial).
- Create a person group (Ex: Accounting Division, Marketing Division).
- Train a person inside that created person group.
- Finally, we can take a new picture and verify it with the person group.
For this, I have made a WPF sample application which can perform these tasks.
Here is the link for the GitHub sample: GitHub FaceRecognition
And you can use this for curl, Java, Javascript, Php, Python. The sample code lines also available for them in here: https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244
In case of any issue, feel free to comment below.
References:
https://blogs.technet.microsoft.com/sltechgeeks/2017/08/27/introduction-to-cognitive-services/