Partager via


FaceClient.DetectAsync Method

Definition

Overloads

DetectAsync(BinaryData, FaceDetectionModel, FaceRecognitionModel, Boolean, IEnumerable<FaceAttributeType>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, CancellationToken)

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

DetectAsync(Uri, FaceDetectionModel, FaceRecognitionModel, Boolean, IEnumerable<FaceAttributeType>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, CancellationToken)

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

DetectAsync(BinaryData, FaceDetectionModel, FaceRecognitionModel, Boolean, IEnumerable<FaceAttributeType>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, CancellationToken)

Source:
FaceClient.cs

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

public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>> DetectAsync (BinaryData imageContent, Azure.AI.Vision.Face.FaceDetectionModel detectionModel, Azure.AI.Vision.Face.FaceRecognitionModel recognitionModel, bool returnFaceId, System.Collections.Generic.IEnumerable<Azure.AI.Vision.Face.FaceAttributeType> returnFaceAttributes = default, bool? returnFaceLandmarks = default, bool? returnRecognitionModel = default, int? faceIdTimeToLive = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DetectAsync : BinaryData * Azure.AI.Vision.Face.FaceDetectionModel * Azure.AI.Vision.Face.FaceRecognitionModel * bool * seq<Azure.AI.Vision.Face.FaceAttributeType> * Nullable<bool> * Nullable<bool> * Nullable<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>>
override this.DetectAsync : BinaryData * Azure.AI.Vision.Face.FaceDetectionModel * Azure.AI.Vision.Face.FaceRecognitionModel * bool * seq<Azure.AI.Vision.Face.FaceAttributeType> * Nullable<bool> * Nullable<bool> * Nullable<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>>
Public Overridable Function DetectAsync (imageContent As BinaryData, detectionModel As FaceDetectionModel, recognitionModel As FaceRecognitionModel, returnFaceId As Boolean, Optional returnFaceAttributes As IEnumerable(Of FaceAttributeType) = Nothing, Optional returnFaceLandmarks As Nullable(Of Boolean) = Nothing, Optional returnRecognitionModel As Nullable(Of Boolean) = Nothing, Optional faceIdTimeToLive As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IReadOnlyList(Of FaceDetectionResult)))

Parameters

imageContent
BinaryData

The input image binary.

detectionModel
FaceDetectionModel

The 'detectionModel' associated with the detected faceIds. Supported 'detectionModel' values include 'detection_01', 'detection_02' and 'detection_03'. The default value is 'detection_01'.

recognitionModel
FaceRecognitionModel

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'.

returnFaceId
Boolean

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

returnFaceAttributes
IEnumerable<FaceAttributeType>

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.

returnFaceLandmarks
Nullable<Boolean>

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

returnRecognitionModel
Nullable<Boolean>

Return 'recognitionModel' or not. The default value is false.

faceIdTimeToLive
Nullable<Int32>

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).

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

imageContent is null.

Remarks

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

Applies to

DetectAsync(Uri, FaceDetectionModel, FaceRecognitionModel, Boolean, IEnumerable<FaceAttributeType>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, CancellationToken)

Source:
FaceClient.cs

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

public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>> DetectAsync (Uri url, Azure.AI.Vision.Face.FaceDetectionModel detectionModel, Azure.AI.Vision.Face.FaceRecognitionModel recognitionModel, bool returnFaceId, System.Collections.Generic.IEnumerable<Azure.AI.Vision.Face.FaceAttributeType> returnFaceAttributes = default, bool? returnFaceLandmarks = default, bool? returnRecognitionModel = default, int? faceIdTimeToLive = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DetectAsync : Uri * Azure.AI.Vision.Face.FaceDetectionModel * Azure.AI.Vision.Face.FaceRecognitionModel * bool * seq<Azure.AI.Vision.Face.FaceAttributeType> * Nullable<bool> * Nullable<bool> * Nullable<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>>
override this.DetectAsync : Uri * Azure.AI.Vision.Face.FaceDetectionModel * Azure.AI.Vision.Face.FaceRecognitionModel * bool * seq<Azure.AI.Vision.Face.FaceAttributeType> * Nullable<bool> * Nullable<bool> * Nullable<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>>
Public Overridable Function DetectAsync (url As Uri, detectionModel As FaceDetectionModel, recognitionModel As FaceRecognitionModel, returnFaceId As Boolean, Optional returnFaceAttributes As IEnumerable(Of FaceAttributeType) = Nothing, Optional returnFaceLandmarks As Nullable(Of Boolean) = Nothing, Optional returnRecognitionModel As Nullable(Of Boolean) = Nothing, Optional faceIdTimeToLive As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IReadOnlyList(Of FaceDetectionResult)))

Parameters

url
Uri

URL of input image.

detectionModel
FaceDetectionModel

The 'detectionModel' associated with the detected faceIds. Supported 'detectionModel' values include 'detection_01', 'detection_02' and 'detection_03'. The default value is 'detection_01'.

recognitionModel
FaceRecognitionModel

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'.

returnFaceId
Boolean

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

returnFaceAttributes
IEnumerable<FaceAttributeType>

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.

returnFaceLandmarks
Nullable<Boolean>

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

returnRecognitionModel
Nullable<Boolean>

Return 'recognitionModel' or not. The default value is false.

faceIdTimeToLive
Nullable<Int32>

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).

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

url is null.

Remarks

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

Applies to