Azure Cognitive Services Face API

Azure Cognitive Services Face API Tutorial

In this Azure tutorial, we will discuss Azure Cognitive Services Face API. Along with this, we will also discuss a few other topics as mentioned below

  • Key Benefits of Azure Cognitive Services Face API
  • Key Features of Azure Cognitive Services Face API
  • Creating The Face API On Azure Portal
  • Implementation of the Azure Cognitive Services Face API
  • Test The Face API using the Microsoft Face API reference URL and Postman tool.

Azure Cognitive Services Face API

Well, here we will discuss an important topic i.e Azure Cognitive Services Face API. The Face API provides an advanced algorithm that helps you to detect or read the 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.

With this world where technologies are growing in a rapid space. We are moving towards implementing machine learning and artificial intelligence all most everywhere. AI-based technologies are really booming now. The Azure Cognitive Services Face API allows the Developers to easily implement these features with just an API call. No expertise needed in the area of AI and ML. Saves a lot of time and effort for the developer 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, then implementing the authentication with the Azure Cognitive Services Face API is one of the best ways. Mainly here we are Verifying and we’re just trying to match a face against a specific person. One of the best examples here is when we are trying to unlock our Mobile or Laptop with the Face unlock feature.

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

The Azure Face API considers different key properties like 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 attributes on the face like eyes, nose, lips, hair, etc.
  • The facial expression of the person like sadness, Happiness, 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, It is easy to use and save a lot of time and coding effort for a developer’s perspective to implement such an amazing AI feature.
  • It helps you with providing the 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 an important aspect, Microsoft has focused more in terms of security in the case of Azure Cognitive Services Face API. High-end security and privacy apply to your data and the model to make sure no unauthorized access.

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

Key Features of Azure Cognitive Services Face API

Well, above we discussed Some key benefits of Azure Cognitive Services Face API. Here 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. Along with this, it provides other attributes like gender, age, hair, nose, eyes, etc, the person wears glasses or not.
  • Identification of a specific known individual.
  • Verification is a type of facial recognition where we are trying to match the face with a single person and not with a group of people.
  • Face grouping, which is a group of the same individual provided a list of faces.

Creating The Face API On Azure Portal

Well, here 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

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

Login to the Azure Portal (https://portal.azure.com/)

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

Creating The Face API On Azure Portal

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

How to Create The Face API On Azure Portal

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 then 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 are just doing this operation for the Demo purposes. You can click on the View pricing Details link to check out the Pricing structure as per your business needs.
  • Select the checkbox to accept the terms and conditions for Creating The Face API On Azure Portal.

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

How to Create The Face API in Azure Portal

Now, it will validate all the details, it will show you Validation Passed, once it will find all the details are correct. Then it will enable the Create button to Create The Face API On Azure Portal. If it will find any of the options is incorrect then it will not enable the Create button. The Create button will remains disable in case of any invalid options entered by you.

Creating The Face API using Azure Portal

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

Creating The Face API Azure Portal

Once, you will click on the Go to resource button, you can able to 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, On the Face API page, click on the Keys and Endpoint from the left navigation and you can able to see Key1 and Key2. you can copy any of the key-value and keep it 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.

create Azure Cognitive Services Face API

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.

Navigate to the Microsoft Face API reference URL

Click on the POST(Detect) link from the left navigation Under Face Dropdown.

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 that you have 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. The image you can upload into the blob storage and make sure it should have public access i.e public server access. You can also use any of the Public servers 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"

}
How to create Microsoft Azure cognitive services 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 to 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 few key points you need to consider while deciding the image.

https://her33fffff.blob.core.windows.net/new123/nwphoto.png
Microsoft Azure Cognitive services face api image

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, we got the proper response code and the proper Response content as shown below.

Microsoft Azure Face API configuration
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 in your machine

Select the HTTP method as POST and then put the URL appending the “detect” word with the URL and 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.

How to configure Microsoft Azure Face API

Now click on the Body and then 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 same URL here as above.

How to test Azure Face API

Now after you entered the headers and the Body then click on the Send button, You can able to 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

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

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

Same way 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 able to see the Output we got as expected.

Implementation Of Face API Using Microsoft Azure

The exact output as 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 if it is working 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 like “&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, we got the expected output. We got the age details.

Implementation Of Azure Face API

Now the same way if we want to get gender, smile, emotion, glasses. We need to append the parameter for gender, smile, emotion, 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 able to get the expected output with all the details age, gender, smile, emotion, 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.

You may also like following the below articles

Wrapping Up

Well, in this article, we discussed Azure Cognitive Services Face API, Key Benefits of Azure Cognitive Services Face API, Key Features of Azure Cognitive Services Face API, Creating The Face API On Azure Portal and we saw the implementation of the Azure Cognitive Services Face API, Test The Face API using the Microsoft Face API reference URL and Postman tool. Hope you have enjoyed this article !!!

Leave a Comment