Rekognition / Client / delete_faces

delete_faces#

Rekognition.Client.delete_faces(**kwargs)#

Deletes faces from a collection. You specify a collection ID and an array of face IDs to remove from the collection.

This operation requires permissions to perform the rekognition:DeleteFaces action.

See also: AWS API Documentation

Request Syntax

response = client.delete_faces(
    CollectionId='string',
    FaceIds=[
        'string',
    ]
)
Parameters:
  • CollectionId (string) –

    [REQUIRED]

    Collection from which to remove the specific faces.

  • FaceIds (list) –

    [REQUIRED]

    An array of face IDs to delete.

    • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'DeletedFaces': [
        'string',
    ],
    'UnsuccessfulFaceDeletions': [
        {
            'FaceId': 'string',
            'UserId': 'string',
            'Reasons': [
                'ASSOCIATED_TO_AN_EXISTING_USER'|'FACE_NOT_FOUND',
            ]
        },
    ]
}

Response Structure

  • (dict) –

    • DeletedFaces (list) –

      An array of strings (face IDs) of the faces that were deleted.

      • (string) –

    • UnsuccessfulFaceDeletions (list) –

      An array of any faces that weren’t deleted.

      • (dict) –

        Contains metadata like FaceId, UserID, and Reasons, for a face that was unsuccessfully deleted.

        • FaceId (string) –

          A unique identifier assigned to the face.

        • UserId (string) –

          A provided ID for the UserID. Unique within the collection.

        • Reasons (list) –

          The reason why the deletion was unsuccessful.

          • (string) –

Exceptions

Examples

This operation deletes one or more faces from a Rekognition collection.

response = client.delete_faces(
    CollectionId='myphotos',
    FaceIds=[
        'ff43d742-0c13-5d16-a3e8-03d3f58e980b',
    ],
)

print(response)

Expected Output:

{
    'DeletedFaces': [
        'ff43d742-0c13-5d16-a3e8-03d3f58e980b',
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}