Partager via


FaceSessionClient Class

FaceSessionClient.

Inheritance
azure.ai.vision.face._client.FaceSessionClient
FaceSessionClient

Constructor

FaceSessionClient(endpoint: str, credential: AzureKeyCredential | TokenCredential, **kwargs: Any)

Parameters

Name Description
endpoint
Required
str

Supported Cognitive Services endpoints (protocol and hostname, for example: https://{resource-name}.cognitiveservices.azure.com). Required.

credential
Required

Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required.

Keyword-Only Parameters

Name Description
api_version

API Version. Default value is "v1.2-preview.1". Note that overriding this default value may result in unsupported behavior.

Methods

close
create_liveness_session

Create a new detect liveness session.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details.

create_liveness_with_verify_session

Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details.

delete_liveness_session

Delete all session related information for matching the specified session id.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/delete-liveness-session for more details.

delete_liveness_with_verify_session

Delete all session related information for matching the specified session id.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/delete-liveness-with-verify-session for more details.

detect_from_session_image

Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and attributes.

Please refer to https://learn.microsoft.com/rest/api/face/face-detection-operations/detect-from-session-image-id for more details.

get_liveness_session_audit_entries

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details.

get_liveness_session_result

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details.

get_liveness_sessions

Lists sessions for /detectLiveness/SingleModal.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details.

get_liveness_with_verify_session_audit_entries

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details.

get_liveness_with_verify_session_result

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.

get_liveness_with_verify_sessions

Lists sessions for /detectLivenessWithVerify/SingleModal.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details.

get_session_image

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-session-image for more details.

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

close

close() -> None

create_liveness_session

Create a new detect liveness session.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details.

create_liveness_session(body: CreateLivenessSessionContent | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> CreateLivenessSessionResult

Parameters

Name Description
body
Required

Body parameter. Is one of the following types: CreateLivenessSessionContent, JSON, IO[bytes] Required.

Returns

Type Description

CreateLivenessSessionResult. The CreateLivenessSessionResult is compatible with MutableMapping

Exceptions

Type Description

create_liveness_with_verify_session

Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details.

create_liveness_with_verify_session(body: _models.CreateLivenessWithVerifySessionContent, *, verify_image: bytes | None, content_type: str = 'application/json', **kwargs: Any) -> _models.CreateLivenessWithVerifySessionResult

Parameters

Name Description
body
Required

Body parameter. Is one of the following types: CreateLivenessWithVerifySessionContent, JSON, IO[bytes] Required.

Returns

Type Description

CreateLivenessWithVerifySessionResult. The CreateLivenessWithVerifySessionResult is compatible with MutableMapping

Exceptions

Type Description

delete_liveness_session

Delete all session related information for matching the specified session id.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/delete-liveness-session for more details.

delete_liveness_session(session_id: str, **kwargs: Any) -> None

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

None

Exceptions

Type Description

delete_liveness_with_verify_session

Delete all session related information for matching the specified session id.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/delete-liveness-with-verify-session for more details.

delete_liveness_with_verify_session(session_id: str, **kwargs: Any) -> None

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

None

Exceptions

Type Description

detect_from_session_image

Detect human faces in an image, return face rectangles, and optionally with faceIds, landmarks, and attributes.

Please refer to https://learn.microsoft.com/rest/api/face/face-detection-operations/detect-from-session-image-id for more details.

detect_from_session_image(body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, session_image_id: str = <object object>, detection_model: str | ~azure.ai.vision.face.models._enums.FaceDetectionModel | None = None, recognition_model: str | ~azure.ai.vision.face.models._enums.FaceRecognitionModel | None = None, return_face_id: bool | None = None, return_face_attributes: ~typing.List[str | ~azure.ai.vision.face.models._enums.FaceAttributeType] | None = None, return_face_landmarks: bool | None = None, return_recognition_model: bool | None = None, face_id_time_to_live: int | None = None, **kwargs: ~typing.Any) -> List[FaceDetectionResult]

Parameters

Name Description
body
Required
<xref:JSON> or IO[bytes]

Is either a JSON type or a IO[bytes] type. Required.

Keyword-Only Parameters

Name Description
session_image_id
str

Id of session image. Required.

detection_model

The 'detectionModel' associated with the detected faceIds. Supported 'detectionModel' values include 'detection_01', 'detection_02' and 'detection_03'. The default value is 'detection_01'. 'detection_03' is recommended since its accuracy is improved on smaller faces (64x64 pixels) and rotated face orientations. Known values are: "detection_01", "detection_02", and "detection_03". Default value is None.

recognition_model

The 'recognitionModel' associated with the detected faceIds. Supported 'recognitionModel' values include 'recognition_01', 'recognition_02', 'recognition_03' or 'recognition_04'. The default value is 'recognition_01'. 'recognition_04' is recommended since its accuracy is improved on faces wearing masks compared with 'recognition_03', and its overall accuracy is improved compared with 'recognition_01' and 'recognition_02'. Known values are: "recognition_01", "recognition_02", "recognition_03", and "recognition_04". Default value is None.

return_face_id

Return faceIds of the detected faces or not. The default value is true. Default value is None.

return_face_attributes

Analyze and return the one or more specified face attributes in the comma-separated string like 'returnFaceAttributes=headPose,glasses'. Face attribute analysis has additional computational and time cost. Default value is None.

return_face_landmarks

Return face landmarks of the detected faces or not. The default value is false. Default value is None.

return_recognition_model

Return 'recognitionModel' or not. The default value is false. This is only applicable when returnFaceId = true. Default value is None.

face_id_time_to_live
int

The number of seconds for the face ID being cached. Supported range from 60 seconds up to 86400 seconds. The default value is 86400 (24 hours). Default value is None.

Returns

Type Description

list of FaceDetectionResult

Exceptions

Type Description

get_liveness_session_audit_entries

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details.

get_liveness_session_audit_entries(session_id: str, *, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionAuditEntry]

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionAuditEntry

Exceptions

Type Description

get_liveness_session_result

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details.

get_liveness_session_result(session_id: str, **kwargs: Any) -> LivenessSession

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

LivenessSession. The LivenessSession is compatible with MutableMapping

Exceptions

Type Description

get_liveness_sessions

Lists sessions for /detectLiveness/SingleModal.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details.

get_liveness_sessions(*, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionItem]

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionItem

Exceptions

Type Description

get_liveness_with_verify_session_audit_entries

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details.

get_liveness_with_verify_session_audit_entries(session_id: str, *, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionAuditEntry]

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionAuditEntry

Exceptions

Type Description

get_liveness_with_verify_session_result

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details.

get_liveness_with_verify_session_result(session_id: str, **kwargs: Any) -> LivenessWithVerifySession

Parameters

Name Description
session_id
Required
str

The unique ID to reference this session. Required.

Returns

Type Description

LivenessWithVerifySession. The LivenessWithVerifySession is compatible with MutableMapping

Exceptions

Type Description

get_liveness_with_verify_sessions

Lists sessions for /detectLivenessWithVerify/SingleModal.

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details.

get_liveness_with_verify_sessions(*, start: str | None = None, top: int | None = None, **kwargs: Any) -> List[LivenessSessionItem]

Keyword-Only Parameters

Name Description
start
str

List resources greater than the "start". It contains no more than 64 characters. Default is empty. Default value is None.

top
int

The number of items to list, ranging in [1, 1000]. Default is 1000. Default value is None.

Returns

Type Description

list of LivenessSessionItem

Exceptions

Type Description

get_session_image

Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-session-image for more details.

get_session_image(session_image_id: str, **kwargs: Any) -> Iterator[bytes]

Parameters

Name Description
session_image_id
Required
str

The request ID of the image to be retrieved. Required.

Returns

Type Description

Iterator[bytes]

Exceptions

Type Description

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse

Parameters

Name Description
request
Required

The network request you want to make. Required.

Keyword-Only Parameters

Name Description
stream

Whether the response payload will be streamed. Defaults to False.

Returns

Type Description

The response of your network call. Does not do error handling on your response.