Cognitive Services Face API

Azure Cognitive Services Face API Tutorial

In this Azure tutorial, we will discuss Azure Cognitive Services Face API.

Cognitive Services Face API

Well, here we will discuss an important topic, i.e., Azure Cognitive Services Face API or What is Azure Face API?

The Face API provides an advanced algorithm that helps you detect or read human faces in different digital images. That includes detecting the emotions and facial expressions like happiness, fear, etc. It also helps to apply the person identification feature that matches an individual up to 1 million people.

In this world where technologies are growing rapidly space. We are moving towards implementing machine learning and artificial intelligence almost everywhere. AI-based technologies are booming now.

The Azure Cognitive Services Face API allows the Developers to implement these features with just an API call. No expertise is needed in the area of AI and ML. It saves the developer a lot of time and effort to implement such an excellent feature in your application.

You can directly integrate the Azure Cognitive Services Face API with your application. It solves a lot of business problems for your application. Especially, when you want to implement the authentication for your Application, implementing the authentication with the Azure Cognitive Services Face API is one of the best ways.

Mainly here, we are Verifying and just trying to match a face against a specific person. One of the best examples is when we try to unlock our Mobile or Laptop with the Face unlock feature.

This API helps us to perform several tasks like face detection, grouping of faces, and face identification when you have a requirement to find similar faces among a group of faces.

The Azure Face API considers different key properties like the one below while detecting a face from an image.

  • The person is a male or a female.
  • The approximate age of the person.
  • The person in the image wears a glass or not.
  • Different facial attributes like eyes, nose, lips, hair, etc.
  • The person’s facial expressions are sadness, happiness, and anger.
  • The scale of emotion for that person.

Key Benefits of Azure Cognitive Services Face API

There are many excellent features of Azure Cognitive Services Face API available. We will discuss a few key features of Azure Cognitive Services Face API.

  • An important feature of Azure Cognitive Services Face API is that it is easy to use and saves a lot of time and coding effort from a developer’s perspective to implement such an amazing AI feature.
  • It helps you by providing an Advanced facial recognition mechanism. You will have the opportunity to implement that in your application.
  • You can deploy the Azure Cognitive Services Face API easily.
  • As security is important, Microsoft has focused more on security in the case of Azure Cognitive Services Face API. High-end security and privacy apply to your data and the model to ensure no unauthorized access.

So these are Some key benefits of Azure Cognitive Services Face API.

Key Features of Azure Cognitive Services Face API

Above, we discussed Some key benefits of Azure Cognitive Services Face API. We will discuss the key features of the Azure Cognitive Services Face API.

  • The first feature of Azure Cognitive Services Face API is Face detection with the exact location of the face in the image. It also provides other attributes like gender, age, hair, nose, eyes, etc., whether the person wears glasses or not.
  • Identification of a specific known individual.
  • Verification is a type of facial recognition where we try to match the face with a single person, not a group.
  • Face grouping is a group of the same individual providing a list of faces.

Creating The Face API On Azure Portal

We will discuss How To Create The Face API On Azure Portal. Before discussing the steps, we need to know the Prerequisites for Creating The Face API On Azure Portal.

Prerequisites

  • You must have a valid Azure Subscription or a Valid Azure Account. If you don’t have till now, create an Azure Free Account now.

Assuming you have a Valid Azure Account or Azure Subscription, Let’s start creating the Face API On Azure Portal.

1. Log in to the Azure Portal (https://portal.azure.com/)

2. Once you log in to the Azure Portal, click the + Create a Resource button from the left side panel.

Microsoft Face API Tutorial

3. On the New window, click on the AI + Machine Learning option from the left side and then click the Face option.

azure face api documentation

On the Create Face window, provide the below details

  • Subscription: Select the valid subscription that you want to use to create the Azure Face API. In case you have multiple subscriptions, make sure to select the correct subscription.
  • Resource Group: Choose an existing Resource Group, and if you don’t have an existing Resource Group, create a new one by clicking on the Create new link as highlighted below.
  • Region: Select the region for your Azure Resource.
  • Name: Provide a unique name for your Azure Face API.
  • Pricing tier: Select the pricing tier as per your business needs. You can choose the Free F0 tier if you do this operation for Demo purposes. You can click the View Pricing Details link to check out the Pricing structure per your business needs.
  • Select the checkbox to accept the terms and conditions for Creating The Face API On Azure Portal.

Finally, click the Review + Create button on the Create Face window.

azure face api demo

4. Now, it will validate all the details and show you Validation Passed once it finds all the details are correct. Then, it will enable the Create button to Create The Face API On the Azure Portal. If it finds any of the options is incorrect, it will not enable the Create button. The Create button will remain disabled if you enter any invalid options.

azure face api

Now as you can see below, The Deployment is completed successfully without any issue. Click the Go to Resource button to navigate to the Face API you have created now.

Microsoft Face API Tutorial

Once you click on the Go to resource button, you can see the Azure Face API that we have created below

How to Create The Face API Azure Portal

The next step is to copy the Key value of the Azure Face API. To copy that, click on the Keys and Endpoint from the left navigation on the Face API page, and you can see Key1 and Key2. You can copy any key values and keep them in a notepad. Click on the Copy button as highlighted to copy the key value. This key value we need while testing the Face API in the next section.

azure face

Now we have created the Face API, we will test it, If it is working fine or not.

Test The Face API

We can able to test the Azure Face API in two ways. Below are the two ways

  • Using the Microsoft Face API reference URL for EastUS (Since the region for my Face API is EastUS. The URL will be based on the Region you have selected for the Microsoft Face API)
  • The second approach is Using the Postman tool.

Using the Microsoft Face API reference URL

Follow the below steps to test the Face API using the Microsoft Face API reference URL.

How to create Azure Cognitive Services Face API
  • Select the region that you have selected while creating your Azure Face API.
azure cognitive services face api
  • In the Headers section, provide the Content-Type as application/JSON and Ocp-Apim-Subscription-key as the key value you copied from the Face API page and kept in a notepad above. Make sure to copy and paste the correct one.
Microsoft azure cognitive services face api
  • Now, the next thing is we need to provide the image URL in the Request body. You can upload the image into the blob storage and ensure it has public access, i.e., public server access. You can also use any Public server to upload the image and use that URL. You should specify the URL of the image in a JSON format like below
{

"url":"https://her33fffff.blob.core.windows.net/new123/nwphoto.png"

}
microsoft azure face api

Below is the image of my family that I have uploaded the image in the blob storage. Few things to note down here

  • The image format should be JPG, PNG, peg, GIF (the first frame), and BMP.
  • The image size must be within 1 KB to 6 MB.
  • The face size should be between 36×36 pixels and 1920×1080 pixels.
  • In an image, up to 100 faces can be returned.
  • The face in the image should be clear and frontal.

These are the key points you must consider while deciding the image.

https://her33fffff.blob.core.windows.net/new123/nwphoto.png
face api azure

Below, you can see the Request URL and HTTP request details. You can cross-check the Key and the image URL details again, just to make sure both the values are correct. Now click on the Send button.

azure face recognition c#

Now you can able to see that we got the proper response code and the proper Response content, as shown below.

azure face recognition api
How to configure Azure Face API

Using The Postman Tool

You can also use the Postman tool to test the Azure Face API. Follow the below steps to test the Azure Face API using the Postman tool.

Open the Postman app that you have installed on your machine

Select the HTTP method as POST and then put the URL appending the “detect” word with the URL. Then, for the Headers, provide the Content-Type option as application/JSON and then provide the key as Ocp-Apim-Subscription-Key and for that value, you provide the key value that you have copied from the Azure Face API page and kept the key in the notepad. These are the values you need to provide for the Headers.

face api azure documentation

Now click on the Body, select the Raw option, and provide the image URL in the JSON format, the same as above. I am using the same image and the exact URL here as above.

How to test Azure Face API

Now, after you enter the headers and the Body and then click on the Send button, You can see we got the expected status code as 200 OK, and we also got the expected output as shown below.

How to test Microsoft Azure Face API

This is the exact output that we got, as shown below

[
    {
        "faceId": "cfb4fb18-f2e2-4d2b-b759-ac1c95c600e1",
        "faceRectangle": {
            "top": 549,
            "left": 583,
            "width": 119,
            "height": 119
        }
    },
    {
        "faceId": "396cb6d7-fc11-4ea2-b453-06fef91675f1",
        "faceRectangle": {
            "top": 95,
            "left": 212,
            "width": 95,
            "height": 95
        }
    },
    {
        "faceId": "b2c770d1-b298-4269-b2ae-a715d313b89c",
        "faceRectangle": {
            "top": 312,
            "left": 109,
            "width": 76,
            "height": 76
        }
    },
    {
        "faceId": "ae8fe0dd-c187-494c-8323-fc7c5838d2fd",
        "faceRectangle": {
            "top": 87,
            "left": 658,
            "width": 66,
            "height": 66
        }
    }
]

This is how we can test the Azure Face API to detect the faces in an image using the Microsoft Face API reference URL and the Postman tool.

Face Landmarks Detection

We can also test the Azure Face API for the Face Landmarks. Face Landmarks will show positions of face components like eyes, nose, lips, etc. in the faces in the image. To get the Face Landmarks details, we need to append the “?returnFaceLandmarks=true” parameter with the detect call URL. So, the URL should look like the one below.

https://eastus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceLandmarks=true

Same as above, the header value and the Request body will remain the same and change the URL like above. Other configurations will remain the same, and now click on the Send button. Now you can see the Output we got as expected.

Implementation Of Face API Using Microsoft Azure

The exact output is below

[
    {
        "faceId": "448a39ef-90f8-468a-b26a-f2e88bef98b0",
        "faceRectangle": {
            "top": 549,
            "left": 583,
            "width": 119,
            "height": 119
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 614.7,
                "y": 584.6
            },
            "pupilRight": {
                "x": 670.9,
                "y": 584.8
            },
            "noseTip": {
                "x": 643.3,
                "y": 604.3
            },
            "mouthLeft": {
                "x": 615,
                "y": 636.6
            },
            "mouthRight": {
                "x": 669.3,
                "y": 635.6
            },
            "eyebrowLeftOuter": {
                "x": 589.5,
                "y": 577.7
            },
            "eyebrowLeftInner": {
                "x": 624.4,
                "y": 567
            },
            "eyeLeftOuter": {
                "x": 605,
                "y": 587.1
            },
            "eyeLeftTop": {
                "x": 611.7,
                "y": 582.8
            },
            "eyeLeftBottom": {
                "x": 611.8,
                "y": 589.1
            },
            "eyeLeftInner": {
                "x": 620.6,
                "y": 586.1
            },
            "eyebrowRightInner": {
                "x": 653.3,
                "y": 567
            },
            "eyebrowRightOuter": {
                "x": 689.8,
                "y": 574.5
            },
            "eyeRightInner": {
                "x": 661.2,
                "y": 586.1
            },
            "eyeRightTop": {
                "x": 669.7,
                "y": 581.9
            },
            "eyeRightBottom": {
                "x": 669.9,
                "y": 588.5
            },
            "eyeRightOuter": {
                "x": 678,
                "y": 586.5
            },
            "noseRootLeft": {
                "x": 635.9,
                "y": 585.3
            },
            "noseRootRight": {
                "x": 649.6,
                "y": 584.6
            },
            "noseLeftAlarTop": {
                "x": 630.5,
                "y": 599.3
            },
            "noseRightAlarTop": {
                "x": 655.9,
                "y": 600
            },
            "noseLeftAlarOutTip": {
                "x": 622.9,
                "y": 609.1
            },
            "noseRightAlarOutTip": {
                "x": 660.4,
                "y": 611.2
            },
            "upperLipTop": {
                "x": 642.2,
                "y": 628
            },
            "upperLipBottom": {
                "x": 641.9,
                "y": 632.5
            },
            "underLipTop": {
                "x": 642.1,
                "y": 637
            },
            "underLipBottom": {
                "x": 641.7,
                "y": 642.6
            }
        }
    },
    {
        "faceId": "a8e693e3-e71a-48da-bdf5-390c49bb919d",
        "faceRectangle": {
            "top": 95,
            "left": 212,
            "width": 95,
            "height": 95
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 237.6,
                "y": 124.2
            },
            "pupilRight": {
                "x": 278.2,
                "y": 118.7
            },
            "noseTip": {
                "x": 257.9,
                "y": 142.9
            },
            "mouthLeft": {
                "x": 241.6,
                "y": 167.5
            },
            "mouthRight": {
                "x": 282.4,
                "y": 162.3
            },
            "eyebrowLeftOuter": {
                "x": 222.6,
                "y": 116.3
            },
            "eyebrowLeftInner": {
                "x": 248.2,
                "y": 113.1
            },
            "eyeLeftOuter": {
                "x": 231.7,
                "y": 124.8
            },
            "eyeLeftTop": {
                "x": 238,
                "y": 121.5
            },
            "eyeLeftBottom": {
                "x": 238.3,
                "y": 126.1
            },
            "eyeLeftInner": {
                "x": 244.2,
                "y": 123.7
            },
            "eyebrowRightInner": {
                "x": 262.8,
                "y": 111
            },
            "eyebrowRightOuter": {
                "x": 296.3,
                "y": 108.2
            },
            "eyeRightInner": {
                "x": 271.9,
                "y": 119.8
            },
            "eyeRightTop": {
                "x": 278.3,
                "y": 116.3
            },
            "eyeRightBottom": {
                "x": 278.9,
                "y": 120.4
            },
            "eyeRightOuter": {
                "x": 285.3,
                "y": 117.4
            },
            "noseRootLeft": {
                "x": 251.2,
                "y": 123.3
            },
            "noseRootRight": {
                "x": 262.4,
                "y": 122.1
            },
            "noseLeftAlarTop": {
                "x": 248.9,
                "y": 137.8
            },
            "noseRightAlarTop": {
                "x": 268.5,
                "y": 135.6
            },
            "noseLeftAlarOutTip": {
                "x": 244,
                "y": 146
            },
            "noseRightAlarOutTip": {
                "x": 275.5,
                "y": 142.4
            },
            "upperLipTop": {
                "x": 259.1,
                "y": 160.2
            },
            "upperLipBottom": {
                "x": 259.7,
                "y": 163.8
            },
            "underLipTop": {
                "x": 261.8,
                "y": 167.2
            },
            "underLipBottom": {
                "x": 262.3,
                "y": 172.7
            }
        }
    },
    {
        "faceId": "94b11ed6-4cdb-4d8a-ab00-b074ca7b0d8d",
        "faceRectangle": {
            "top": 312,
            "left": 109,
            "width": 76,
            "height": 76
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 130.3,
                "y": 334.1
            },
            "pupilRight": {
                "x": 163.9,
                "y": 330.9
            },
            "noseTip": {
                "x": 142.7,
                "y": 353.4
            },
            "mouthLeft": {
                "x": 135.7,
                "y": 370.3
            },
            "mouthRight": {
                "x": 164.2,
                "y": 366.7
            },
            "eyebrowLeftOuter": {
                "x": 114.7,
                "y": 328.1
            },
            "eyebrowLeftInner": {
                "x": 134.3,
                "y": 328
            },
            "eyeLeftOuter": {
                "x": 124.3,
                "y": 335
            },
            "eyeLeftTop": {
                "x": 129.2,
                "y": 332.1
            },
            "eyeLeftBottom": {
                "x": 129.7,
                "y": 337.5
            },
            "eyeLeftInner": {
                "x": 134.8,
                "y": 334.9
            },
            "eyebrowRightInner": {
                "x": 151.7,
                "y": 324.9
            },
            "eyebrowRightOuter": {
                "x": 175.9,
                "y": 323.1
            },
            "eyeRightInner": {
                "x": 156.6,
                "y": 332.6
            },
            "eyeRightTop": {
                "x": 162.4,
                "y": 328.5
            },
            "eyeRightBottom": {
                "x": 163.7,
                "y": 333.7
            },
            "eyeRightOuter": {
                "x": 168.8,
                "y": 330.2
            },
            "noseRootLeft": {
                "x": 139.6,
                "y": 335.4
            },
            "noseRootRight": {
                "x": 149.3,
                "y": 334.7
            },
            "noseLeftAlarTop": {
                "x": 137,
                "y": 348.2
            },
            "noseRightAlarTop": {
                "x": 151.9,
                "y": 347.1
            },
            "noseLeftAlarOutTip": {
                "x": 134.1,
                "y": 355.6
            },
            "noseRightAlarOutTip": {
                "x": 155.9,
                "y": 353.7
            },
            "upperLipTop": {
                "x": 147.2,
                "y": 366.3
            },
            "upperLipBottom": {
                "x": 147.7,
                "y": 369
            },
            "underLipTop": {
                "x": 147.8,
                "y": 370
            },
            "underLipBottom": {
                "x": 148.6,
                "y": 375
            }
        }
    },
    {
        "faceId": "0fbb8ae8-1d43-444e-9389-1862494d8d2a",
        "faceRectangle": {
            "top": 87,
            "left": 658,
            "width": 66,
            "height": 66
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 678.9,
                "y": 104
            },
            "pupilRight": {
                "x": 708.1,
                "y": 107.5
            },
            "noseTip": {
                "x": 689.7,
                "y": 118.5
            },
            "mouthLeft": {
                "x": 676.6,
                "y": 135.4
            },
            "mouthRight": {
                "x": 701.1,
                "y": 138.1
            },
            "eyebrowLeftOuter": {
                "x": 666.8,
                "y": 97.5
            },
            "eyebrowLeftInner": {
                "x": 686.8,
                "y": 95
            },
            "eyeLeftOuter": {
                "x": 673.1,
                "y": 104.2
            },
            "eyeLeftTop": {
                "x": 678.2,
                "y": 102
            },
            "eyeLeftBottom": {
                "x": 677.4,
                "y": 106.4
            },
            "eyeLeftInner": {
                "x": 682.6,
                "y": 104.9
            },
            "eyebrowRightInner": {
                "x": 701.6,
                "y": 96.6
            },
            "eyebrowRightOuter": {
                "x": 720.4,
                "y": 101.9
            },
            "eyeRightInner": {
                "x": 703.8,
                "y": 107.6
            },
            "eyeRightTop": {
                "x": 709,
                "y": 105.8
            },
            "eyeRightBottom": {
                "x": 708.3,
                "y": 110
            },
            "eyeRightOuter": {
                "x": 713.2,
                "y": 109.1
            },
            "noseRootLeft": {
                "x": 687.7,
                "y": 106.2
            },
            "noseRootRight": {
                "x": 697.5,
                "y": 107.3
            },
            "noseLeftAlarTop": {
                "x": 683.2,
                "y": 115
            },
            "noseRightAlarTop": {
                "x": 697.8,
                "y": 116.3
            },
            "noseLeftAlarOutTip": {
                "x": 679.9,
                "y": 120
            },
            "noseRightAlarOutTip": {
                "x": 700,
                "y": 122.3
            },
            "upperLipTop": {
                "x": 688.6,
                "y": 130.7
            },
            "upperLipBottom": {
                "x": 688,
                "y": 134.2
            },
            "underLipTop": {
                "x": 688.1,
                "y": 136.9
            },
            "underLipBottom": {
                "x": 687.7,
                "y": 141.4
            }
        }
    }
]

This is how we can check the Face Landmarks feature to see if it works using the Postman tool.

Face Attributes

In the same way, we can also get different face attributes like age, gender, smile, hair, glasses, emotion, etc. For example, if we want to detect the age details, we need to append the parameter “&returnFaceAttributes=age“. with the Face Landmarks parameter, The URL should look like below

https://eastus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceLandmarks=true&returnFaceAttributes=age

All other configurations will remain the same. Now click on the Send button. You can able to see that we got the expected output. We got the age details.

Implementation Of Azure Face API

Now, if we want to get gender, smile, emotion, glasses. We need to append the parameter for gender, smile, emotion, and glasses with the age URL as above. Now, the URL should look like below

https://eastus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceLandmarks=true&returnFaceAttributes=age,gender,smile,emotion,glasses

Other configurations will remain the same. Now click on the Send button. You can get the expected output with all the details: age, gender, smile, emotion, and glasses.

Implementation Of Microsoft Azure Face API

The exact output that we got looks like below

[
    {
        "faceId": "e30af67a-00ee-421c-ad02-fbf763234e9f",
        "faceRectangle": {
            "top": 549,
            "left": 583,
            "width": 119,
            "height": 119
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 614.7,
                "y": 584.6
            },
            "pupilRight": {
                "x": 670.9,
                "y": 584.8
            },
            "noseTip": {
                "x": 643.3,
                "y": 604.3
            },
            "mouthLeft": {
                "x": 615,
                "y": 636.6
            },
            "mouthRight": {
                "x": 669.3,
                "y": 635.6
            },
            "eyebrowLeftOuter": {
                "x": 589.5,
                "y": 577.7
            },
            "eyebrowLeftInner": {
                "x": 624.4,
                "y": 567
            },
            "eyeLeftOuter": {
                "x": 605,
                "y": 587.1
            },
            "eyeLeftTop": {
                "x": 611.7,
                "y": 582.8
            },
            "eyeLeftBottom": {
                "x": 611.8,
                "y": 589.1
            },
            "eyeLeftInner": {
                "x": 620.6,
                "y": 586.1
            },
            "eyebrowRightInner": {
                "x": 653.3,
                "y": 567
            },
            "eyebrowRightOuter": {
                "x": 689.8,
                "y": 574.5
            },
            "eyeRightInner": {
                "x": 661.2,
                "y": 586.1
            },
            "eyeRightTop": {
                "x": 669.7,
                "y": 581.9
            },
            "eyeRightBottom": {
                "x": 669.9,
                "y": 588.5
            },
            "eyeRightOuter": {
                "x": 678,
                "y": 586.5
            },
            "noseRootLeft": {
                "x": 635.9,
                "y": 585.3
            },
            "noseRootRight": {
                "x": 649.6,
                "y": 584.6
            },
            "noseLeftAlarTop": {
                "x": 630.5,
                "y": 599.3
            },
            "noseRightAlarTop": {
                "x": 655.9,
                "y": 600
            },
            "noseLeftAlarOutTip": {
                "x": 622.9,
                "y": 609.1
            },
            "noseRightAlarOutTip": {
                "x": 660.4,
                "y": 611.2
            },
            "upperLipTop": {
                "x": 642.2,
                "y": 628
            },
            "upperLipBottom": {
                "x": 641.9,
                "y": 632.5
            },
            "underLipTop": {
                "x": 642.1,
                "y": 637
            },
            "underLipBottom": {
                "x": 641.7,
                "y": 642.6
            }
        },
        "faceAttributes": {
            "smile": 0.284,
            "gender": "female",
            "age": 10,
            "glasses": "ReadingGlasses",
            "emotion": {
                "anger": 0,
                "contempt": 0.139,
                "disgust": 0,
                "fear": 0,
                "happiness": 0.284,
                "neutral": 0.576,
                "sadness": 0,
                "surprise": 0
            }
        }
    },
    {
        "faceId": "bffed3e1-acc0-42a6-85cf-42ea6599e37e",
        "faceRectangle": {
            "top": 95,
            "left": 212,
            "width": 95,
            "height": 95
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 237.6,
                "y": 124.2
            },
            "pupilRight": {
                "x": 278.2,
                "y": 118.7
            },
            "noseTip": {
                "x": 257.9,
                "y": 142.9
            },
            "mouthLeft": {
                "x": 241.6,
                "y": 167.5
            },
            "mouthRight": {
                "x": 282.4,
                "y": 162.3
            },
            "eyebrowLeftOuter": {
                "x": 222.6,
                "y": 116.3
            },
            "eyebrowLeftInner": {
                "x": 248.2,
                "y": 113.1
            },
            "eyeLeftOuter": {
                "x": 231.7,
                "y": 124.8
            },
            "eyeLeftTop": {
                "x": 238,
                "y": 121.5
            },
            "eyeLeftBottom": {
                "x": 238.3,
                "y": 126.1
            },
            "eyeLeftInner": {
                "x": 244.2,
                "y": 123.7
            },
            "eyebrowRightInner": {
                "x": 262.8,
                "y": 111
            },
            "eyebrowRightOuter": {
                "x": 296.3,
                "y": 108.2
            },
            "eyeRightInner": {
                "x": 271.9,
                "y": 119.8
            },
            "eyeRightTop": {
                "x": 278.3,
                "y": 116.3
            },
            "eyeRightBottom": {
                "x": 278.9,
                "y": 120.4
            },
            "eyeRightOuter": {
                "x": 285.3,
                "y": 117.4
            },
            "noseRootLeft": {
                "x": 251.2,
                "y": 123.3
            },
            "noseRootRight": {
                "x": 262.4,
                "y": 122.1
            },
            "noseLeftAlarTop": {
                "x": 248.9,
                "y": 137.8
            },
            "noseRightAlarTop": {
                "x": 268.5,
                "y": 135.6
            },
            "noseLeftAlarOutTip": {
                "x": 244,
                "y": 146
            },
            "noseRightAlarOutTip": {
                "x": 275.5,
                "y": 142.4
            },
            "upperLipTop": {
                "x": 259.1,
                "y": 160.2
            },
            "upperLipBottom": {
                "x": 259.7,
                "y": 163.8
            },
            "underLipTop": {
                "x": 261.8,
                "y": 167.2
            },
            "underLipBottom": {
                "x": 262.3,
                "y": 172.7
            }
        },
        "faceAttributes": {
            "smile": 0.693,
            "gender": "male",
            "age": 29,
            "glasses": "ReadingGlasses",
            "emotion": {
                "anger": 0,
                "contempt": 0.007,
                "disgust": 0,
                "fear": 0,
                "happiness": 0.693,
                "neutral": 0.299,
                "sadness": 0,
                "surprise": 0
            }
        }
    },
    {
        "faceId": "281c3f24-0005-4cef-83b0-fc76d34e6a2f",
        "faceRectangle": {
            "top": 312,
            "left": 109,
            "width": 76,
            "height": 76
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 130.3,
                "y": 334.1
            },
            "pupilRight": {
                "x": 163.9,
                "y": 330.9
            },
            "noseTip": {
                "x": 142.7,
                "y": 353.4
            },
            "mouthLeft": {
                "x": 135.7,
                "y": 370.3
            },
            "mouthRight": {
                "x": 164.2,
                "y": 366.7
            },
            "eyebrowLeftOuter": {
                "x": 114.7,
                "y": 328.1
            },
            "eyebrowLeftInner": {
                "x": 134.3,
                "y": 328
            },
            "eyeLeftOuter": {
                "x": 124.3,
                "y": 335
            },
            "eyeLeftTop": {
                "x": 129.2,
                "y": 332.1
            },
            "eyeLeftBottom": {
                "x": 129.7,
                "y": 337.5
            },
            "eyeLeftInner": {
                "x": 134.8,
                "y": 334.9
            },
            "eyebrowRightInner": {
                "x": 151.7,
                "y": 324.9
            },
            "eyebrowRightOuter": {
                "x": 175.9,
                "y": 323.1
            },
            "eyeRightInner": {
                "x": 156.6,
                "y": 332.6
            },
            "eyeRightTop": {
                "x": 162.4,
                "y": 328.5
            },
            "eyeRightBottom": {
                "x": 163.7,
                "y": 333.7
            },
            "eyeRightOuter": {
                "x": 168.8,
                "y": 330.2
            },
            "noseRootLeft": {
                "x": 139.6,
                "y": 335.4
            },
            "noseRootRight": {
                "x": 149.3,
                "y": 334.7
            },
            "noseLeftAlarTop": {
                "x": 137,
                "y": 348.2
            },
            "noseRightAlarTop": {
                "x": 151.9,
                "y": 347.1
            },
            "noseLeftAlarOutTip": {
                "x": 134.1,
                "y": 355.6
            },
            "noseRightAlarOutTip": {
                "x": 155.9,
                "y": 353.7
            },
            "upperLipTop": {
                "x": 147.2,
                "y": 366.3
            },
            "upperLipBottom": {
                "x": 147.7,
                "y": 369
            },
            "underLipTop": {
                "x": 147.8,
                "y": 370
            },
            "underLipBottom": {
                "x": 148.6,
                "y": 375
            }
        },
        "faceAttributes": {
            "smile": 0.001,
            "gender": "female",
            "age": 9,
            "glasses": "NoGlasses",
            "emotion": {
                "anger": 0,
                "contempt": 0.008,
                "disgust": 0,
                "fear": 0,
                "happiness": 0.001,
                "neutral": 0.99,
                "sadness": 0,
                "surprise": 0
            }
        }
    },
    {
        "faceId": "a0f0f65b-5b31-4dfe-a19b-12fb631cbefa",
        "faceRectangle": {
            "top": 87,
            "left": 658,
            "width": 66,
            "height": 66
        },
        "faceLandmarks": {
            "pupilLeft": {
                "x": 678.9,
                "y": 104
            },
            "pupilRight": {
                "x": 708.1,
                "y": 107.5
            },
            "noseTip": {
                "x": 689.7,
                "y": 118.5
            },
            "mouthLeft": {
                "x": 676.6,
                "y": 135.4
            },
            "mouthRight": {
                "x": 701.1,
                "y": 138.1
            },
            "eyebrowLeftOuter": {
                "x": 666.8,
                "y": 97.5
            },
            "eyebrowLeftInner": {
                "x": 686.8,
                "y": 95
            },
            "eyeLeftOuter": {
                "x": 673.1,
                "y": 104.2
            },
            "eyeLeftTop": {
                "x": 678.2,
                "y": 102
            },
            "eyeLeftBottom": {
                "x": 677.4,
                "y": 106.4
            },
            "eyeLeftInner": {
                "x": 682.6,
                "y": 104.9
            },
            "eyebrowRightInner": {
                "x": 701.6,
                "y": 96.6
            },
            "eyebrowRightOuter": {
                "x": 720.4,
                "y": 101.9
            },
            "eyeRightInner": {
                "x": 703.8,
                "y": 107.6
            },
            "eyeRightTop": {
                "x": 709,
                "y": 105.8
            },
            "eyeRightBottom": {
                "x": 708.3,
                "y": 110
            },
            "eyeRightOuter": {
                "x": 713.2,
                "y": 109.1
            },
            "noseRootLeft": {
                "x": 687.7,
                "y": 106.2
            },
            "noseRootRight": {
                "x": 697.5,
                "y": 107.3
            },
            "noseLeftAlarTop": {
                "x": 683.2,
                "y": 115
            },
            "noseRightAlarTop": {
                "x": 697.8,
                "y": 116.3
            },
            "noseLeftAlarOutTip": {
                "x": 679.9,
                "y": 120
            },
            "noseRightAlarOutTip": {
                "x": 700,
                "y": 122.3
            },
            "upperLipTop": {
                "x": 688.6,
                "y": 130.7
            },
            "upperLipBottom": {
                "x": 688,
                "y": 134.2
            },
            "underLipTop": {
                "x": 688.1,
                "y": 136.9
            },
            "underLipBottom": {
                "x": 687.7,
                "y": 141.4
            }
        },
        "faceAttributes": {
            "smile": 0,
            "gender": "female",
            "age": 8,
            "glasses": "NoGlasses",
            "emotion": {
                "anger": 0,
                "contempt": 0,
                "disgust": 0,
                "fear": 0,
                "happiness": 0,
                "neutral": 1,
                "sadness": 0,
                "surprise": 0
            }
        }
    }
]

This is how we can get all the Face attributes using the Azure Face API. This is an end-to-end tutorial on the Azure Cognitive Services Face API.

Wrapping Up

Well, in this article, we discussed Microsoft cognitive services face API. I hope you have enjoyed this article !!!