AWS Code Sample
Catalog demonstrates how to list the faces in an Amazon Rekognition collection.

# Copyright 2010-2019, Inc. or its affiliates. All Rights Reserved. # # This file is licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. A copy of the # License is located at # # # # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS # OF ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. import boto3 if __name__ == "__main__": # Change collectionID to the required collection. collectionId='MyCollection' maxResults=2 tokens=True client=boto3.client('rekognition') response=client.list_faces(CollectionId=collectionId, MaxResults=maxResults) print('Faces in collection ' + collectionId) while tokens: faces=response['Faces'] for face in faces: print (face) if 'NextToken' in response: nextToken=response['NextToken'] response=client.list_faces(CollectionId=collectionId, NextToken=nextToken,MaxResults=maxResults) else: tokens=False

Sample Details

Service: rekognition

Last tested: 2019-01-3

Author: reesch (AWS)

Type: full-example

On this page: