Skip to content

Commit cbb7de7

Browse files
authored
Update README.md (#35757)
1 parent a9ffe94 commit cbb7de7

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

sdk/face/azure-ai-vision-face/README.md

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Azure Ai Vision Face client library for Python
1+
# Azure AI Face client library for Python
22

33
The Azure AI Face service provides AI algorithms that detect, recognize, and analyze human faces in images. It includes the following main features:
44

@@ -24,13 +24,13 @@ The Azure AI Face service provides AI algorithms that detect, recognize, and ana
2424
- Your Azure account must have a `Cognitive Services Contributor` role assigned in order for you to agree to the responsible AI terms and create a resource. To get this role assigned to your account, follow the steps in the [Assign roles][azure_role_assignment] documentation, or contact your administrator.
2525
- Once you have sufficient permissions to control your Azure subscription, you need either
2626
* an [Azure Face account][azure_portal_list_face_account] or
27-
* an [Azure Cognitive Service account][azure_portal_list_cognitive_service_account]
27+
* an [Azure AI services multi-service account][azure_portal_list_cognitive_service_account]
2828

29-
### Create a Face or a Cognitive Services resource
29+
### Create a Face or an Azure AI services multi-service account
3030

31-
Azure AI Face supports both [multi-service][azure_cognitive_service_account] and single-service access. Create a Cognitive Services resource if you plan to access multiple cognitive services under a single endpoint/key. For Face access only, create a Face resource. Please note that you will need a single-service resource if you intend to use [Microsoft Entra ID authentication](#create-the-client-with-an-azure-active-directory-credential).
31+
Azure AI Face supports both [multi-service][azure_cognitive_service_account] and single-service access. Create an Azure AI services multi-service account if you plan to access multiple Azure AI services under a single endpoint/key. For Face access only, create a Face resource.
3232

33-
* To create a new Face or Cognitive Services account, you can use [Azure Portal][azure_portal_create_face_account], [Azure PowerShell][quick_start_create_account_via_azure_powershell], or [Azure CLI][quick_start_create_account_via_azure_cli].
33+
* To create a new Face or Azure AI services multi-service account, you can use [Azure Portal][azure_portal_create_face_account], [Azure PowerShell][quick_start_create_account_via_azure_powershell], or [Azure CLI][quick_start_create_account_via_azure_cli].
3434

3535
### Install the package
3636

@@ -62,31 +62,12 @@ Regional endpoint: https://<region>.api.cognitive.microsoft.com/
6262
Custom subdomain: https://<resource-name>.cognitiveservices.azure.com/
6363
```
6464

65-
A regional endpoint is the same for every resource in a region. A complete list of supported regional endpoints can be consulted [here][regional_endpoints]. Please note that regional endpoints do not support Microsoft Entra ID authentication.
65+
A regional endpoint is the same for every resource in a region. A complete list of supported regional endpoints can be consulted [here][regional_endpoints]. Please note that regional endpoints do not support Microsoft Entra ID authentication. If you'd like migrate your resource to use custom subdomain, follow the instructions [here][how_to_migrate_resource_to_custom_subdomain].
6666

67-
A custom subdomain, on the other hand, is a name that is unique to the Face resource. They can only be used by [single-service resources][azure_portal_create_face_account].
67+
A custom subdomain, on the other hand, is a name that is unique to the resource. Once created and linked to a resource, it cannot be modified.
6868

6969

70-
#### Create the client with AzureKeyCredential
71-
72-
To use an API key as the `credential` parameter, pass the key as a string into an instance of [AzureKeyCredential][azure_sdk_python_azure_key_credential].
73-
You can get the API key for your Face resource using the [Azure Portal][get_key_via_azure_portal] or [Azure CLI][get_key_via_azure_cli]:
74-
75-
```bash
76-
# Get the API keys for the Face resource
77-
az cognitiveservices account keys list --name "<resource-name>" --resource-group "<resource-group-name>"
78-
```
79-
80-
```python
81-
from azure.core.credentials import AzureKeyCredential
82-
from azure.ai.vision.face import FaceClient
83-
84-
endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
85-
credential = AzureKeyCredential("<api_key>")
86-
face_client = FaceClient(endpoint, credential)
87-
```
88-
89-
#### Create the client with an Microsoft Entra ID credential
70+
#### Create the client with a Microsoft Entra ID credential
9071

9172
`AzureKeyCredential` authentication is used in the examples in this getting started guide, but you can also authenticate with Microsoft Entra ID using the [azure-identity][azure_sdk_python_identity] library.
9273
Note that regional endpoints do not support Microsoft Entra ID authentication. Create a [custom subdomain][custom_subdomain] name for your resource in order to use this type of authentication.
@@ -115,6 +96,26 @@ credential = DefaultAzureCredential()
11596
face_client = FaceClient(endpoint, credential)
11697
```
11798

99+
#### Create the client with AzureKeyCredential
100+
101+
To use an API key as the `credential` parameter, pass the key as a string into an instance of [AzureKeyCredential][azure_sdk_python_azure_key_credential].
102+
You can get the API key for your Face resource using the [Azure Portal][get_key_via_azure_portal] or [Azure CLI][get_key_via_azure_cli]:
103+
104+
```bash
105+
# Get the API keys for the Face resource
106+
az cognitiveservices account keys list --name "<resource-name>" --resource-group "<resource-group-name>"
107+
```
108+
109+
```python
110+
from azure.core.credentials import AzureKeyCredential
111+
from azure.ai.vision.face import FaceClient
112+
113+
endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
114+
credential = AzureKeyCredential("<api_key>")
115+
face_client = FaceClient(endpoint, credential)
116+
```
117+
118+
118119
## Key concepts
119120

120121
### FaceClient
@@ -125,7 +126,7 @@ face_client = FaceClient(endpoint, credential)
125126
and optionally with landmarks, and face-related attributes. This operation is required as a first step in all the
126127
other face recognition scenarios.
127128
- Face recognition: Confirm that a user is who they claim to be based on how closely their face data matches the target face.
128-
It includes Face verification ("one-to-one" matching) and Face identification ("one-to-many" matching).
129+
It includes Face verification ("one-to-one" matching).
129130
- Finding similar faces from a smaller set of faces that look similar to the target face.
130131
- Grouping faces into several smaller groups based on similarity.
131132

@@ -196,17 +197,17 @@ Face Liveness detection can be used to determine if a face in an input video str
196197
The goal of liveness detection is to ensure that the system is interacting with a physically present live person at
197198
the time of authentication. The whole process of authentication is called a session.
198199

199-
There are two different components in the authentication: a mobile application and an app server/orchestrator.
200-
Before uploading the video stream, the app server has to create a session, and then the mobile client could upload
200+
There are two different components in the authentication: a frontend application and an app server/orchestrator.
201+
Before uploading the video stream, the app server has to create a session, and then the frontend client could upload
201202
the payload with a `session authorization token` to call the liveness detection. The app server can query for the
202203
liveness detection result and audit logs anytime until the session is deleted.
203204

204205
The Liveness detection operation can not only confirm if the input is live or spoof, but also verify whether the input
205206
belongs to the expected person's face, which is called **liveness detection with face verification**. For the detail
206207
information, please refer to the [tutorial][liveness_tutorial].
207208

208-
This package is only responsible for creating, quering, deleting a session and getting audit logs. For how to perform a
209-
liveness detection, please see the sample of [mobile applications][integrate_liveness_into_mobile_application].
209+
This package is only responsible for app server to create, query, delete a session and get audit logs. For how to
210+
integrate the UI and the code into your native frontend application, please follow instructions in the [tutorial][liveness_tutorial].
210211

211212
Here is an example to create and get the liveness detection result of a session.
212213
```python
@@ -361,6 +362,7 @@ additional questions or comments.
361362
[get_key_via_azure_portal]: https://learn.microsoft.com/azure/ai-services/multi-service-resource?tabs=windows&pivots=azportal#get-the-keys-for-your-resource
362363
[get_key_via_azure_cli]: https://learn.microsoft.com/azure/ai-services/multi-service-resource?tabs=windows&pivots=azcli#get-the-keys-for-your-resource
363364
[regional_endpoints]: https://azure.microsoft.com/global-infrastructure/services/?products=cognitive-services
365+
[how_to_migrate_resource_to_custom_subdomain]: https://learn.microsoft.com/azure/ai-services/cognitive-services-custom-subdomains#how-does-this-impact-existing-resources
364366
[azure_sdk_python_azure_key_credential]: https://aka.ms/azsdk/python/core/azurekeycredential
365367
[azure_sdk_python_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
366368
[custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
@@ -375,7 +377,6 @@ additional questions or comments.
375377
[evaluate_different_detection_models]: https://learn.microsoft.com/azure/ai-services/computer-vision/how-to/specify-detection-model#evaluate-different-models
376378
[recommended_recognition_model]: https://learn.microsoft.com/azure/ai-services/computer-vision/how-to/specify-recognition-model#recommended-model
377379
[liveness_tutorial]: https://learn.microsoft.com/azure/ai-services/computer-vision/tutorials/liveness
378-
[integrate_liveness_into_mobile_application]: https://learn.microsoft.com/azure/ai-services/computer-vision/tutorials/liveness#integrate-liveness-into-mobile-application
379380

380381
[python_azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions
381382
[face_errors]: https://aka.ms/face-error-codes-and-messages

0 commit comments

Comments
 (0)