Detecting Faces with Azure Computer Vision | AI-102 Exam Preparation

Detecting Faces with Azure Computer Vision

Question

You are tasked to identify the faces in a large set of images.

You decide to use Computer Vision Image Analysis in Azure to detect the faces.

Review the code snippet given below and complete it by choosing the correct values.

(select two answers)

Console.WriteLine("Faces:"); foreach (var face in results.Faces) { Console.WriteLine($"A {face…………………….} of age {face.…………………….} at location {face.FaceRectangle.Left}, "+$"{face.FaceRectangle.Left}, {face.FaceRectangle.Top + face.FaceRectangle.Width}, " +$"{face.FaceRectangle.Top + face.FaceRectangle.Height}"); } Console.WriteLine(); 

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answers: C and E

Here is the completed code

<pre class="brush:java;">Console.WriteLine("Faces:");

foreach (var face in results.Faces)

{

Console.WriteLine($"A {face.Gender} of age {face.Age} at location {face.FaceRectangle.Left}, "+$"{face.FaceRectangle.Left}, {face.FaceRectangle.Top + face.FaceRectangle.Width}, " +$"{face.FaceRectangle.Top + face.FaceRectangle.Height}");

}

Console.WriteLine();

</pre>Option A is incorrect because with image analysis values for gender, age and rectangle for the detected face is given.

Confidence score is not provided.

Option B is incorrect because with image analysis values for gender, age and rectangle for the detected face is given.

Name is the value output with features such as brands or tags, not with the face feature.

As given in the completed code above, option C is correct because with image analysis values for gender, age and rectangle for the detected face is given.

Option D is incorrect because with image analysis values for gender, age and rectangle for the detected face is given.

Score is value with cateroy feature.

As given in the completed code above, option E is correct because with image analysis values for gender, age and rectangle for the detected face is given.

Reference:

To learn more about face detection feature and values, use the link given below:

The code snippet provided is iterating through a collection of detected faces in an image using the Azure Cognitive Services Computer Vision API. It is using the Face API, which is part of the Computer Vision API, to detect faces and their attributes.

The code is incomplete, and we need to choose the correct values to complete the code.

The Face API detects various attributes of the detected faces. In the given code snippet, we need to complete the following line:

csharp
Console.WriteLine($"A {face…………………….} of age {face.…………………….} at location {face.FaceRectangle.Left}, "+$"{face.FaceRectangle.Left}, {face.FaceRectangle.Top + face.FaceRectangle.Width}, " +$"{face.FaceRectangle.Top + face.FaceRectangle.Height}");

The first blank should contain the attribute of the face that we want to display, and the second blank should contain the attribute of the face that specifies the age of the detected face.

The options provided are:

A. Confidence B. Name C. Gender D. Score E. Age.

Out of these options, we need to choose two values that are relevant to display the detected faces' attributes.

The correct options are:

A. Confidence and E. Age.

The confidence score represents the level of certainty that the Face API has in its detection results. It is a value between 0 and 1, with 1 being the highest confidence. However, it's not necessary to display it in the output.

The age attribute represents the estimated age of the detected face. It is a relevant attribute to display in the output.

So, the correct code snippet should look like this:

csharp
Console.WriteLine("Faces:"); foreach (var face in results.Faces) { Console.WriteLine($"A face of age {face.Age} at location {face.FaceRectangle.Left}, " + $"{face.FaceRectangle.Left}, {face.FaceRectangle.Top + face.FaceRectangle.Width}, " + $"{face.FaceRectangle.Top + face.FaceRectangle.Height}"); } Console.WriteLine();

In summary, the code uses Azure's Computer Vision API to detect faces in an image and displays their age and location in the console.