本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭DisassociateFaces
配使用 AWS SDK或 CLI
下列程式碼範例會示範如何使用DisassociateFaces
。
- CLI
-
- AWS CLI
-
aws rekognition disassociate-faces --face-ids list-of-face-ids --user-id user-id --collection-id collection-name --region region-name
-
有API關詳細資訊,請參閱 DisassociateFaces
(AWS CLI 指令參考。
-
- Python
-
- SDK對於 Python(肉毒桿菌 3)
-
from botocore.exceptions import ClientError import boto3 import logging logger = logging.getLogger(__name__) session = boto3.Session(profile_name='profile-name') client = session.client('rekognition') def disassociate_faces(collection_id, user_id, face_ids): """ Disassociate stored faces within collection to the given user :param collection_id: The ID of the collection where user and faces are stored. :param user_id: The ID of the user that we want to disassociate faces from :param face_ids: The list of face IDs to be disassociated from the given user :return: response of AssociateFaces API """ logger.info(f'Disssociating faces from user: {user_id}, {face_ids}') try: response = client.disassociate_faces( CollectionId=collection_id, UserId=user_id, FaceIds=face_ids ) print(f'- disassociated {len(response["DisassociatedFaces"])} faces') except ClientError: logger.exception("Failed to disassociate faces from the given user") raise else: print(response) return response def main(): face_ids = ["faceId1", "faceId2"] collection_id = "collection-id" user_id = "user-id" disassociate_faces(collection_id, user_id, face_ids) if __name__ == "__main__": main()
-
有API關詳細資訊,請參閱 DisassociateFaces(AWS SDK對於 Python(肉毒桿 3)API參考。
-
有關的完整列表 AWS SDK開發人員指南和代碼示例,請參閱使用 Rekognition 搭配 AWS SDK。本主題也包含有關入門的資訊以及舊SDK版的詳細資訊。
DetectText
GetCelebrityInfo