如果并且仅当您在为集合中的这些面编制索引时将这些详细信息存储在数据库中时(如果在您的用例中)
存储在数据库中,因此在从数据库中检索与从中获取的结果相对应的结果时,必须筛选数据。
response = rekognition.search_faces_by_image(
CollectionId='collection_name',
Image={'Bytes':image_crop_binary}
)
if len(response['FaceMatches']) > 0:
# Return results
for match in response['FaceMatches']:
face = dynamodb.get_item(
TableName='table_name',
Key={'RekognitionId': {'S': match['Face']['FaceId']}}
)
if 'Item' in face:
event = face['Item']['event_name']['S']
full = face['Item']['full_name']['S']
if(event=='newevent'):
#your code goes here , i.e what you want to do if event=="newevent"