FaceClient.FindSimilarFromLargeFaceList Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
FindSimilarFromLargeFaceList(RequestContent, RequestContext) |
[Protocol Method] Given query face's faceId, to search the similar-looking faces from a Large Face List. A 'largeFaceListId' is created by Create Large Face List.
|
FindSimilarFromLargeFaceList(Guid, String, Nullable<Int32>, Nullable<FindSimilarMatchMode>, CancellationToken) |
Given query face's faceId, to search the similar-looking faces from a Large Face List. A 'largeFaceListId' is created by Create Large Face List. |
FindSimilarFromLargeFaceList(RequestContent, RequestContext)
- Source:
- FaceClient.cs
[Protocol Method] Given query face's faceId, to search the similar-looking faces from a Large Face List. A 'largeFaceListId' is created by Create Large Face List.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler FindSimilarFromLargeFaceList(Guid, String, Nullable<Int32>, Nullable<FindSimilarMatchMode>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response FindSimilarFromLargeFaceList (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member FindSimilarFromLargeFaceList : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.FindSimilarFromLargeFaceList : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function FindSimilarFromLargeFaceList (content As RequestContent, Optional context As RequestContext = Nothing) As Response
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call FindSimilarFromLargeFaceList and parse the result.
Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
faceId = "c5c24a82-6845-4031-9d5d-978df9175426",
maxNumOfCandidatesReturned = 3,
mode = "matchPerson",
largeFaceListId = "your_large_face_list_id",
});
Response response = client.FindSimilarFromLargeFaceList(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result[0].GetProperty("confidence").ToString());
Applies to
FindSimilarFromLargeFaceList(Guid, String, Nullable<Int32>, Nullable<FindSimilarMatchMode>, CancellationToken)
- Source:
- FaceClient.cs
Given query face's faceId, to search the similar-looking faces from a Large Face List. A 'largeFaceListId' is created by Create Large Face List.
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceFindSimilarResult>> FindSimilarFromLargeFaceList (Guid faceId, string largeFaceListId, int? maxNumOfCandidatesReturned = default, Azure.AI.Vision.Face.FindSimilarMatchMode? mode = default, System.Threading.CancellationToken cancellationToken = default);
abstract member FindSimilarFromLargeFaceList : Guid * string * Nullable<int> * Nullable<Azure.AI.Vision.Face.FindSimilarMatchMode> * System.Threading.CancellationToken -> Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceFindSimilarResult>>
override this.FindSimilarFromLargeFaceList : Guid * string * Nullable<int> * Nullable<Azure.AI.Vision.Face.FindSimilarMatchMode> * System.Threading.CancellationToken -> Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.AI.Vision.Face.FaceFindSimilarResult>>
Public Overridable Function FindSimilarFromLargeFaceList (faceId As Guid, largeFaceListId As String, Optional maxNumOfCandidatesReturned As Nullable(Of Integer) = Nothing, Optional mode As Nullable(Of FindSimilarMatchMode) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of IReadOnlyList(Of FaceFindSimilarResult))
Parameters
- faceId
- Guid
faceId of the query face. User needs to call "Detect" first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call.
- largeFaceListId
- String
An existing user-specified unique candidate Large Face List, created in "Create Large Face List". Large Face List contains a set of persistedFaceIds which are persisted and will never expire.
The number of top similar faces returned. The valid range is [1, 1000]. Default value is 20.
- mode
- Nullable<FindSimilarMatchMode>
Similar face searching mode. It can be 'matchPerson' or 'matchFace'. Default value is 'matchPerson'.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
largeFaceListId
is null.
Examples
This sample shows how to call FindSimilarFromLargeFaceList.
Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);
Response<IReadOnlyList<FaceFindSimilarResult>> response = client.FindSimilarFromLargeFaceList(Guid.Parse("c5c24a82-6845-4031-9d5d-978df9175426"), "your_large_face_list_id");
Remarks
Please refer to https://learn.microsoft.com/rest/api/face/face-recognition-operations/find-similar-from-large-face-list for more details.