Rekognition / Client / create_collection
create_collection#
- Rekognition.Client.create_collection(**kwargs)#
Creates a collection in an AWS Region. You can add faces to the collection using the IndexFaces operation.
For example, you might create collections, one for each of your application users. A user can then index faces using the
IndexFaces
operation and persist results in a specific collection. Then, a user can search the collection for faces in the user-specific container.When you create a collection, it is associated with the latest version of the face model version.
Note
Collection names are case-sensitive.
This operation requires permissions to perform the
rekognition:CreateCollection
action. If you want to tag your collection, you also require permission to perform therekognition:TagResource
operation.See also: AWS API Documentation
Request Syntax
response = client.create_collection( CollectionId='string', Tags={ 'string': 'string' } )
- Parameters:
CollectionId (string) –
[REQUIRED]
ID for the collection that you are creating.
Tags (dict) –
A set of tags (key-value pairs) that you want to attach to the collection.
(string) –
(string) –
- Return type:
dict
- Returns:
Response Syntax
{ 'StatusCode': 123, 'CollectionArn': 'string', 'FaceModelVersion': 'string' }
Response Structure
(dict) –
StatusCode (integer) –
HTTP status code indicating the result of the operation.
CollectionArn (string) –
Amazon Resource Name (ARN) of the collection. You can use this to manage permissions on your resources.
FaceModelVersion (string) –
Version number of the face detection model associated with the collection you are creating.
Exceptions
Rekognition.Client.exceptions.InvalidParameterException
Rekognition.Client.exceptions.AccessDeniedException
Rekognition.Client.exceptions.InternalServerError
Rekognition.Client.exceptions.ThrottlingException
Rekognition.Client.exceptions.ProvisionedThroughputExceededException
Rekognition.Client.exceptions.ResourceAlreadyExistsException
Rekognition.Client.exceptions.ServiceQuotaExceededException
Examples
This operation creates a Rekognition collection for storing image data.
response = client.create_collection( CollectionId='myphotos', ) print(response)
Expected Output:
{ 'CollectionArn': 'aws:rekognition:us-west-2:123456789012:collection/myphotos', 'StatusCode': 200, 'ResponseMetadata': { '...': '...', }, }