exam questions

Exam AI-102 All Questions

View all questions & answers for the AI-102 exam

Exam AI-102 topic 2 question 15 discussion

Actual exam question from Microsoft's AI-102
Question #: 15
Topic #: 2
[All AI-102 Questions]

HOTSPOT -
You develop an application that uses the Face API.
You need to add multiple images to a person group.
How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: Stream -
The File.OpenRead(String) method opens an existing file for reading.
Example: Open the stream and read it back.
using (FileStream fs = File.OpenRead(path))

Box 2: CreateAsync -
Create the persons for the PersonGroup. Persons are created concurrently.
Example:
await faceClient.PersonGroupPerson.CreateAsync(personGroupId, personName);
Reference:
https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/how-to-add-faces

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
leo822
Highly Voted 2 years, 12 months ago
AddFaceFromStreamAsync. Step 5 on https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/how-to-add-faces
upvoted 69 times
rdemontis
7 months, 1 week ago
thanks for the provided document. Clearly wrong the second answer. It should be AddFaceFromStreamAsync
upvoted 3 times
...
...
azurelearner666
Highly Voted 2 years, 11 months ago
Wrong! A - Stream (this is correct) B - AddFaceFromStreamAsync (literally the same code from Step 5 at https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/how-to-add-faces)
upvoted 51 times
...
NagaoShingo
Most Recent 6 days, 1 hour ago
1. Stream 2. AddFaceFromStreamAsync
upvoted 2 times
...
hatanaoki
2 weeks ago
1. Stream 2. AddFaceFromStreamAsync
upvoted 1 times
...
nanaw770
2 weeks, 3 days ago
1. Stream 2. AddFaceFromStreamAsync
upvoted 1 times
...
nanaw770
2 weeks, 3 days ago
Stream and CreateAsync
upvoted 1 times
...
varinder82
2 months, 2 weeks ago
Final Answer: A - Stream (this is correct) B - AddFaceFromStreamAsync
upvoted 2 times
...
chenglim
7 months, 2 weeks ago
1. Stream 2. AddFaceFromStreamAsync https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/how-to/add-faces#step-5-add-faces-to-the-persons
upvoted 2 times
...
zellck
11 months, 2 weeks ago
1. Stream 2. AddFaceFromStreamAsync https://learn.microsoft.com/en-us/azure/cognitive-services/computer-vision/how-to/add-faces#step-5-add-faces-to-the-persons
upvoted 5 times
...
examworld
1 year ago
Stream AddFaceFromStreamAsync
upvoted 1 times
...
Mike19D
1 year, 1 month ago
Stream AddFaceFromStreamAsync
upvoted 1 times
...
ninjia
1 year, 10 months ago
Box 1: Stream Box 2: AddFaceFromStreamAsync File.OpenRead() returns a Stream object. using (Stream stream = File.OpenRead(imagePath)) { await faceClient.PersonGroupPerson.AddFaceFromStreamAsync(personGroupId, personId, stream); } ref: https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/how-to/add-faces#step-5-add-faces-to-the-persons
upvoted 3 times
...
Eltooth
1 year, 10 months ago
Stream and AddFaceFromStreamAsync are correct answers. https://docs.microsoft.com/en-us/azure/cognitive-services/computer-vision/how-to/add-faces#step-5-add-faces-to-the-persons
upvoted 3 times
...
Deepusuraj
2 years, 4 months ago
Parallel.For(0, PersonCount, async i => { Guid personId = persons[i].PersonId; string personImageDir = @"/path/to/person/i/images"; foreach (string imagePath in Directory.GetFiles(personImageDir, "*.jpg")) { await WaitCallLimitPerSecondAsync(); using (Stream stream = File.OpenRead(imagePath)) { await faceClient.PersonGroupPerson.AddFaceFromStreamAsync(personGroupId, personId, stream); } } });
upvoted 2 times
...
sumanshu
2 years, 5 months ago
Stream and AddFaceFromStreamAsync
upvoted 3 times
...
Happiness20
2 years, 8 months ago
Parallel.For(0, PersonCount, async i => { Guid personId = persons[i].PersonId; string personImageDir = @"/path/to/person/i/images"; foreach (string imagePath in Directory.GetFiles(personImageDir, "*.jpg")) { await WaitCallLimitPerSecondAsync(); using (Stream stream = File.OpenRead(imagePath)) { await faceClient.PersonGroupPerson.AddFaceFromStreamAsync(personGroupId, personId, stream); } } }); https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/how-to-add-faces
upvoted 3 times
...
Happiness20
2 years, 8 months ago
Parallel.For(0, PersonCount, async i => { Guid personId = persons[i].PersonId; string personImageDir = @"/path/to/person/i/images"; foreach (string imagePath in Directory.GetFiles(personImageDir, "*.jpg")) { await WaitCallLimitPerSecondAsync(); using (Stream stream = File.OpenRead(imagePath)) { await faceClient.PersonGroupPerson.AddFaceFromStreamAsync(personGroupId, personId, stream); } } }); https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/how-to-add-faces
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago