Partager via


FaceClient.Detect Method

Definition

Overloads

Detect(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.

Detect(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.

Detect(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 Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>> Detect (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 Detect : 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 -> Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>
override this.Detect : 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 -> Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>
Public Overridable Function Detect (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 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

Detect(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 Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>> Detect (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 Detect : 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 -> Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>
override this.Detect : 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 -> Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceDetectionResult>>
Public Overridable Function Detect (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 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