AWS SDK 또는 CLI와 함께 DisassociateFaces 사용 - Amazon Rekognition

AWS SDK 또는 CLI와 함께 DisassociateFaces 사용

다음 코드 예시는 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 세부 정보는 AWS CLI 명령 참조DisassociateFaces를 참조하세요.

Python
SDK for Python(Boto3)
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()

AWS SDK 개발자 가이드 및 코드 예시의 전체 목록은 AWS SDK와 함께 Rekognition 사용 섹션을 참조하세요. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.