Skip to content

Commit 42cd5e1

Browse files
authored
Merge pull request #87457 from PatrickFarley/face-python-qs
[cog serv] add verify section
2 parents 1a067d0 + 8b7e090 commit 42cd5e1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

articles/cognitive-services/Face/QuickStarts/python-sdk.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Use the Face client library for Python to:
2121
* Find similar faces
2222
* Create and train a person group
2323
* Identify a face
24+
* Verify faces
2425
* Take a snapshot for data migration
2526

2627
[Reference documentation](https://docs.microsoft.com/python/api/azure-cognitiveservices-vision-face/?view=azure-python) | [Library source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/cognitiveservices/azure-cognitiveservices-vision-face) | [Package (PiPy)](https://pypi.org/project/azure-cognitiveservices-vision-face/) | [Samples](https://azure.microsoft.com/resources/samples/?service=cognitive-services&term=Face&sort=0)
@@ -85,6 +86,7 @@ These code snippets show you how to do the following tasks with the Face client
8586
* [Find similar faces](#find-similar-faces)
8687
* [Create and train a person group](#create-and-train-a-person-group)
8788
* [Identify a face](#identify-a-face)
89+
* [Verify faces](#verify-faces)
8890
* [Take a snapshot for data migration](#take-a-snapshot-for-data-migration)
8991

9092
## Authenticate the client
@@ -181,6 +183,32 @@ The **identify** method takes an array of detected faces and compares them to a
181183

182184
[!code-python[](~/cognitive-services-quickstart-code/python/Face/FaceQuickstart.py?name=snippet_identify)]
183185

186+
## Verify faces
187+
188+
The Verify operation takes a face ID and either another face ID or a **Person** object and determines whether they belong to the same person.
189+
190+
The following code detects faces in two source images and then verifies them against a face detected from a target image.
191+
192+
### Get test images
193+
194+
The following code blocks declare variables that will point to the source and target images for the verification operation.
195+
196+
[!code-python[](~/cognitive-services-quickstart-code/python/Face/FaceQuickstart.py?name=snippet_verify_baseurl)]
197+
198+
[!code-python[](~/cognitive-services-quickstart-code/python/Face/FaceQuickstart.py?name=snippet_verify_photos)]
199+
200+
### Detect faces for verification
201+
202+
The following code detects faces in the source and target images and saves them to variables.
203+
204+
[!code-python[](~/cognitive-services-quickstart-code/python/Face/FaceQuickstart.py?name=snippet_verify_detect)]
205+
206+
### Get verification results
207+
208+
The following code compares each of the source images to the target image and prints a message indicating whether they belong to the same person.
209+
210+
[!code-python[](~/cognitive-services-quickstart-code/python/Face/FaceQuickstart.py?name=snippet_verify)]
211+
184212
## Take a snapshot for data migration
185213

186214
The Snapshots feature lets you move your saved face data, such as a trained **PersonGroup**, to a different Azure Cognitive Services Face subscription. You may want to use this feature if, for example, you've created a **PersonGroup** object using a free trial subscription and now want to migrate it to a paid subscription. See the [Migrate your face data](../Face-API-How-to-Topics/how-to-migrate-face-data.md) for a broad overview of the Snapshots feature.

0 commit comments

Comments
 (0)