Face Recognition Operations - Group

Divide candidate faces into groups based on face similarity.

    • The output is one or more disjointed face groups and a messyGroup. A face group contains faces that have similar looking, often of the same person. Face groups are ranked by group size, i.e. number of faces. Notice that faces belonging to a same person might be split into several groups in the result.
    • MessyGroup is a special face group containing faces that cannot find any similar counterpart face from original faces. The messyGroup will not appear in the result if all faces found their counterparts.
    • Group API needs at least 2 candidate faces and 1000 at most. We suggest to try "Verify Face To Face" when you only have 2 candidate faces.
    • The 'recognitionModel' associated with the query faces' faceIds should be the same.
POST {endpoint}/face/{apiVersion}/group

URI Parameters

Name In Required Type Description
apiVersion
path True

string

API Version

endpoint
path True

string

uri

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

Request Body

Name Required Type Description
faceIds True

string[]

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

Responses

Name Type Description
200 OK

GroupingResult

A successful call returns one or more groups of similar faces (rank by group size) and a messyGroup.

Other Status Codes

FaceErrorResponse

An unexpected error response.

Headers

x-ms-error-code: string

Security

Ocp-Apim-Subscription-Key

The secret key for your Azure AI Face subscription.

Type: apiKey
In: header

AADToken

The Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: accessCode
Authorization URL: https://api.example.com/oauth2/authorize
Token URL: https://api.example.com/oauth2/token

Scopes

Name Description
https://cognitiveservices.azure.com/.default

Examples

Group Face IDs

Sample request

POST {endpoint}/face/v1.2-preview.1/group

{
  "faceIds": [
    "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"
  ]
}

Sample response

{
  "groups": [
    [
      "c5c24a82-6845-4031-9d5d-978df9175426",
      "015839fb-fbd9-4f79-ace9-7675fc2f1dd9",
      "fce92aed-d578-4d2e-8114-068f8af4492e",
      "b64d5e15-8257-4af2-b20a-5a750f8940e7"
    ],
    [
      "65d083d4-9447-47d1-af30-b626144bf0fb",
      "30ea1073-cc9e-4652-b1e3-d08fb7b95315"
    ]
  ],
  "messyGroup": [
    "be386ab3-af91-4104-9e6d-4dae4c9fddb7",
    "fbd2a038-dbff-452c-8e79-2ee81b1aa84e"
  ]
}

Definitions

Name Description
FaceError

The error object. For comprehensive details on error codes and messages returned by the Face Service, please refer to the following link: https://aka.ms/face-error-codes-and-messages.

FaceErrorResponse

A response containing error details.

GroupingResult

Response body for group face operation.

FaceError

The error object. For comprehensive details on error codes and messages returned by the Face Service, please refer to the following link: https://aka.ms/face-error-codes-and-messages.

Name Type Description
code

string

One of a server-defined set of error codes.

message

string

A human-readable representation of the error.

FaceErrorResponse

A response containing error details.

Name Type Description
error

FaceError

The error object.

GroupingResult

Response body for group face operation.

Name Type Description
groups

string[]

A partition of the original faces based on face similarity. Groups are ranked by number of faces.

messyGroup

string[]

Face ids array of faces that cannot find any similar faces from original faces.