次の方法で共有


FaceClient.GroupAsync Method

Definition

Overloads

GroupAsync(RequestContent, RequestContext)

[Protocol Method] Divide candidate faces into groups based on face similarity.

GroupAsync(IEnumerable<Guid>, CancellationToken)

Divide candidate faces into groups based on face similarity.

GroupAsync(RequestContent, RequestContext)

Source:
FaceClient.cs

[Protocol Method] Divide candidate faces into groups based on face similarity.

public virtual System.Threading.Tasks.Task<Azure.Response> GroupAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member GroupAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GroupAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GroupAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of 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 GroupAsync 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
{
    faceIds = new object[]
    {
        "c5c24a82-6845-4031-9d5d-978df9175426",
        "015839fb-fbd9-4f79-ace9-7675fc2f1dd9",
        "65d083d4-9447-47d1-af30-b626144bf0fb",
        "fce92aed-d578-4d2e-8114-068f8af4492e",
        "30ea1073-cc9e-4652-b1e3-d08fb7b95315",
        "be386ab3-af91-4104-9e6d-4dae4c9fddb7",
        "fbd2a038-dbff-452c-8e79-2ee81b1aa84e",
        "b64d5e15-8257-4af2-b20a-5a750f8940e7"
    },
});
Response response = await client.GroupAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("groups")[0][0].ToString());
Console.WriteLine(result.GetProperty("messyGroup")[0].ToString());

Applies to

GroupAsync(IEnumerable<Guid>, CancellationToken)

Source:
FaceClient.cs

Divide candidate faces into groups based on face similarity.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.FaceGroupingResult>> GroupAsync (System.Collections.Generic.IEnumerable<Guid> faceIds, System.Threading.CancellationToken cancellationToken = default);
abstract member GroupAsync : seq<Guid> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.FaceGroupingResult>>
override this.GroupAsync : seq<Guid> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.FaceGroupingResult>>
Public Overridable Function GroupAsync (faceIds As IEnumerable(Of Guid), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of FaceGroupingResult))

Parameters

faceIds
IEnumerable<Guid>

Array of candidate faceIds created by "Detect". The maximum is 1000 faces.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

faceIds is null.

Examples

This sample shows how to call GroupAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);

Response<FaceGroupingResult> response = await client.GroupAsync(new Guid[] { Guid.Parse("c5c24a82-6845-4031-9d5d-978df9175426"), Guid.Parse("015839fb-fbd9-4f79-ace9-7675fc2f1dd9"), Guid.Parse("65d083d4-9447-47d1-af30-b626144bf0fb"), Guid.Parse("fce92aed-d578-4d2e-8114-068f8af4492e"), Guid.Parse("30ea1073-cc9e-4652-b1e3-d08fb7b95315"), Guid.Parse("be386ab3-af91-4104-9e6d-4dae4c9fddb7"), Guid.Parse("fbd2a038-dbff-452c-8e79-2ee81b1aa84e"), Guid.Parse("b64d5e15-8257-4af2-b20a-5a750f8940e7") });

Remarks

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

Applies to