Skip to content

Commit a39155e

Browse files
authored
more detail and support ps
1 parent d03a751 commit a39155e

File tree

1 file changed

+81
-6
lines changed

1 file changed

+81
-6
lines changed

articles/ai-services/computer-vision/includes/identity-curl-quickstart.md

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ Get started with facial recognition using the Face REST API. The Face service pr
2424
* You'll need the key and endpoint from the resource you create to connect your application to the Face API. You'll paste your key and endpoint into the code below later in the quickstart.
2525
* You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
2626
* [PowerShell version 6.0+](/powershell/scripting/install/installing-powershell-core-on-windows), or a similar command-line application.
27-
* [cURL](https://curl.haxx.se/) installed.
28-
27+
* [cURL](https://curl.se/) installed.
2928

3029

3130

@@ -34,58 +33,134 @@ Get started with facial recognition using the Face REST API. The Face service pr
3433
> [!NOTE]
3534
> If you haven't received access to the Face service using the [intake form](https://aka.ms/facerecognition), some of these functions won't work.
3635
37-
1. First, call the Detect API on the source face. This is the face that we'll try to identify from the larger group. Copy the following command to a text editor, insert your own key, and then copy it into a shell window and run it.
36+
1. First, call the Detect API on the source face. This is the face that we'll try to identify from the larger group. Copy the following command to a text editor, insert your own key and endpoint, and then copy it into a shell window and run it.
37+
38+
#### [Windows](#tab/windows)
39+
40+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_detect":::
41+
42+
#### [Linux](#tab/linux)
3843

3944
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_detect":::
4045

46+
---
47+
4148
Save the returned face ID string to a temporary location. You'll use it again at the end.
4249

43-
1. Next you'll need to create a **LargePersonGroup**. This object will store the aggregated face data of several persons. Run the following command, inserting your own key. Optionally, change the group's name and metadata in the request body.
50+
1. Next you'll need to create a **LargePersonGroup** and give it an arbitrary ID that matches regex pattern `^[a-z0-9-_]+$`. This object will store the aggregated face data of several persons. Run the following command, inserting your own key. Optionally, change the group's name and metadata in the request body.
51+
52+
#### [Windows](#tab/windows)
53+
54+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_create_persongroup":::
55+
56+
#### [Linux](#tab/linux)
4457

4558
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_create_persongroup":::
4659

47-
Save the returned ID of the created group to a temporary location.
60+
---
61+
62+
Save the specified ID of the created group to a temporary location.
4863

4964
1. Next, you'll create **Person** objects that belong to the group. Run the following command, inserting your own key and the ID of the **LargePersonGroup** from the previous step. This command creates a **Person** named "Family1-Dad".
5065

66+
#### [Windows](#tab/windows)
67+
68+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_create_person":::
69+
70+
#### [Linux](#tab/linux)
71+
5172
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_create_person":::
5273

74+
---
75+
5376
After you run this command, run it again with different input data to create more **Person** objects: "Family1-Mom", "Family1-Son", "Family1-Daughter", "Family2-Lady", and "Family2-Man".
5477

5578
Save the IDs of each **Person** created; it's important to keep track of which person name has which ID.
5679

5780
1. Next you'll need to detect new faces and associate them with the **Person** objects that exist. The following command detects a face from the image *Family1-Dad1.jpg* and adds it to the corresponding person. You need to specify the `personId` as the ID that was returned when you created the "Family1-Dad" **Person** object. The image name corresponds to the name of the created **Person**. Also enter the **LargePersonGroup** ID and your key in the appropriate fields.
5881

82+
#### [Windows](#tab/windows)
83+
84+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_add_face":::
85+
86+
#### [Linux](#tab/linux)
87+
5988
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_add_face":::
6089

90+
---
91+
6192
Then, run the above command again with a different source image and target **Person**. The images available are: *Family1-Dad1.jpg*, *Family1-Dad2.jpg* *Family1-Mom1.jpg*, *Family1-Mom2.jpg*, *Family1-Son1.jpg*, *Family1-Son2.jpg*, *Family1-Daughter1.jpg*, *Family1-Daughter2.jpg*, *Family2-Lady1.jpg*, *Family2-Lady2.jpg*, *Family2-Man1.jpg*, and *Family2-Man2.jpg*. Be sure that the **Person** whose ID you specify in the API call matches the name of the image file in the request body.
6293

6394
At the end of this step, you should have multiple **Person** objects that each have one or more corresponding faces, detected directly from the provided images.
6495

6596
1. Next, train the **LargePersonGroup** with the current face data. The training operation teaches the model how to associate facial features, sometimes aggregated from multiple source images, to each single person. Insert the **LargePersonGroup** ID and your key before running the command.
6697

98+
#### [Windows](#tab/windows)
99+
100+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_train":::
101+
102+
#### [Linux](#tab/linux)
103+
67104
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_train":::
105+
106+
---
68107

108+
1. Check whether the training status is succeeded. If not, wait for a while and query again.
109+
110+
#### [Windows](#tab/windows)
111+
112+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_check_status":::
113+
114+
#### [Linux](#tab/linux)
115+
116+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_check_status":::
117+
118+
---
119+
69120
1. Now you're ready to call the Identify API, using the source face ID from the first step and the **LargePersonGroup** ID. Insert these values into the appropriate fields in the request body, and insert your key.
70121

122+
#### [Windows](#tab/windows)
123+
124+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_identify":::
125+
126+
#### [Linux](#tab/linux)
127+
71128
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_identify":::
72129

130+
---
131+
73132
The response should give you a **Person** ID indicating the person identified with the source face. It should be the ID that corresponds to the "Family1-Dad" person, because the source face is of that person.
74133

75134
1. To do face verification, you'll use the **Person** ID returned in the previous step, the **LargePersonGroup** ID, and also the source face ID. Insert these values into the fields in the request body, and insert your key.
76135

136+
#### [Windows](#tab/windows)
137+
138+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="verify":::
139+
140+
#### [Linux](#tab/linux)
141+
77142
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="verify":::
78143

144+
---
145+
79146
The response should give you a boolean verification result along with a confidence value.
80147

81148

82149

83150
## Clean up resources
84151

85-
To delete the **LargePersonGroup** you created in this exercise, run the LargePersonGroup - Delete call.
152+
To delete the **LargePersonGroup** you created in this exercise, run the [LargePersonGroup - Delete](/rest/api/face/person-group-operations/delete-large-person-group) call.
153+
154+
#### [Windows](#tab/windows)
155+
156+
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.ps1" ID="identify_delete":::
157+
158+
#### [Linux](#tab/linux)
86159

87160
:::code source="~/cognitive-services-quickstart-code/curl/face/detect.sh" ID="identify_delete":::
88161

162+
---
163+
89164
If you want to clean up and remove an Azure AI services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with it.
90165

91166
* [Portal](../../multi-service-resource.md?pivots=azportal#clean-up-resources)

0 commit comments

Comments
 (0)