

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 유명 인사 인식
<a name="celebrities"></a>

Amazon Rekognition을 사용하면 고객은 쉽게 기계 학습을 사용하여 이미지와 동영상에서 수만 명의 유명 인사를 자동으로 인식할 수 있습니다. 유명 인사 인식 API에서 제공하는 메타데이터는 콘텐츠에 태그를 지정하고 검색을 쉽게 만드는 데 필요한 반복적인 수동 작업을 크게 줄여줍니다.

이미지 및 동영상 콘텐츠의 급속한 확산으로 인해 미디어 회사는 자사 미디어 카탈로그를 대규모로 구성, 검색 및 활용하는 데 자주 어려움을 겪습니다. 뉴스 채널과 스포츠 방송사는 현 상황에 대응하고 관련 프로그램을 제작하기 위해 이미지와 동영상을 빠르게 찾아야 할 때가 많습니다. 메타데이터가 충분하지 않으면 이러한 작업이 어려워지지만 Amazon Rekognition을 사용하면 대량의 신규 또는 아카이브 콘텐츠에 자동으로 태그를 지정하여 배우, 운동 선수, 온라인 콘텐츠 크리에이터 등 세계적으로 널리 알려진 광범위한 유명 인사들을 쉽게 검색할 수 있습니다.

Amazon Rekognition 유명 인사 인식은 이미지나 동영상에 알려진 유명 인사가 있을 것으로 예상되는 경우에만 사용하도록 설계되었습니다. 유명 인사가 아닌 얼굴의 인식에 대한 내용은 [컬렉션에서 얼굴 검색](collections.md) 단원을 참조하십시오.

**참고**  
귀하 자신이 유명 인사이고 이 기능에 포함되는 것을 원하지 않으시면 [AWS Support](https://aws.amazon.com/contact-us/)에 문의하시거나 rekognition-celebrity-opt-out@amazon.com으로 이메일을 보내 주세요.

**Topics**
+ [얼굴 검색과 유명 인사 인식 비교](celebrity-recognition-vs-face-search.md)
+ [이미지 속 유명 인사 인식](celebrities-procedure-image.md)
+ [저장된 동영상 속 유명 인사 인식](celebrities-video-sqs.md)
+ [유명 인사에 대한 정보 얻기](get-celebrity-info-procedure.md)

# 얼굴 검색과 유명 인사 인식 비교
<a name="celebrity-recognition-vs-face-search"></a>

Amazon Rekognition은 유명 인사 인식 기능과 얼굴 인식 기능을 모두 제공합니다. 이들 기능은 사용 사례 및 모범 사례에서 몇 가지 중요한 차이가 있습니다.

유명 인사 인식은 스포츠, 미디어, 정치 및 비즈니스 분야에서 수십만 명이 넘는 유명 인사를 인식할 수 있도록 미리 학습되어 있습니다. 이 기능은 대량의 이미지 또는 비디오를 검색하여 특정 유명 인사가 포함되어 있을 수 있는 소량의 이미지 또는 비디오를 식별하도록 설계되었으며 유명 인사가 아닌 사람들의 얼굴이 일치하는지를 알아보기 위한 것이 아닙니다. 유명 인사 일치의 정확도가 중요한 상황에서는 인간 작업자가 이 기능을 통해 간추려진 콘텐츠를 검토하여 적절한 인간의 판단을 통해 높은 정확도를 확보하는 것이 좋습니다. 유명 인사 인식은 시민적 자유를 침해할 수 있는 방식으로 사용해서는 안 됩니다.

그에 반해, 얼굴 인식은 유명 인사뿐 아니라 모든 개인을 대상으로 신원을 확인하거나 검색하기 위한 자체 얼굴 벡터로 자체 얼굴 컬렉션을 생성할 수 있는 보다 범용적인 기능입니다. 얼굴 인식은 건물 출입 승인, 공공 안전, 소셜 미디어와 같은 애플리케이션에 사용될 수 있습니다. 이러한 사용 사례 모두에서 모범 사례, 적절한 신뢰도(공공 안전 사용 사례의 경우 99%), 일치의 정확도가 중요한 상황에서는 인간 작업자에 의한 검토를 사용하는 것이 좋습니다.

자세한 내용은 [컬렉션에서 얼굴 검색](collections.md) 단원을 참조하십시오.

# 이미지 속 유명 인사 인식
<a name="celebrities-procedure-image"></a>

이미지 속 유명 인사를 인식하고, 인식한 유명 인사에 대한 추가 정보를 얻으려면 [RecognizeCelebrities](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_RecognizeCelebrities.html) 비 스토리지 API 작업을 사용하세요. 예를 들어 정보 수집 타이밍이 중요한 소셜 미디어 또는 뉴스 및 엔터테인먼트 업계에서는 `RecognizeCelebrities` 작업을 사용하여 한 이미지에서 무려 64명의 유명 인사를 식별하고 유명 인사의 웹 페이지가 있다면 그 링크를 반환할 수 있습니다. Amazon Rekognition은 어떤 이미지에서 유명 인사를 감지했는지 기억하지 않습니다. 애플리케이션에서 이 정보를 저장해야 합니다.

`RecognizeCelebrities`에서 반환한 유명 인사에 대한 추가 정보를 저장하지 않은 상태에서 해당 정보를 얻기 위해 이미지를 재분석하는 것을 피하려면 [GetCelebrityInfo](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetCelebrityInfo.html)를 사용하세요. `GetCelebrityInfo`를 직접적으로 호출하려면 Amazon Rekognition이 각 유명 인사에게 할당하는 고유한 식별자가 필요합니다. 식별자는 이미지에서 인식된 각 유명 인사에 대한 `RecognizeCelebrities` 응답의 일부로 반환됩니다.

유명 인사 인식을 위해 처리할 이미지 모음이 많은 경우, [AWS Batch](https://docs.aws.amazon.com/batch/latest/userguide/)를 사용해 백그라운드에서 일괄적으로 `RecognizeCelebrities`에 대한 호출을 처리하는 방법을 고려하십시오. 컬렉션에 새 이미지를 추가할 때 AWS Lambda 함수를 사용하여 이미지가 S3 버킷에 업로드`RecognizeCelebrities`될 때를 호출하여 유명 인사를 인식할 수 있습니다.

## RecognizeCelebrities 호출
<a name="recognize-image-example"></a>

 AWS Command Line Interface () 또는 AWS SDK를 사용하여 입력 이미지를 이미지 바이트 배열(base64 인코딩 이미지 바이트AWS CLI) 또는 Amazon S3 객체로 제공할 수 있습니다. 이 AWS CLI 절차에서는 .jpg 또는 .png 형식의 이미지를 S3 버킷에 업로드합니다. AWS SDK 절차에서는 로컬 파일 시스템에서 로드된 이미지를 사용합니다. 입력 이미지 권장 사항에 대한 자세한 내용은 [이미지 작업](images.md) 단원을 참조하십시오.

이 절차를 실행하려면 에서 한 명 이상의 유명 인사 얼굴이 포함된 이미지 파일이 필요합니다.

**이미지에서 유명인 인식**

1. 아직 설정하지 않았다면 다음과 같이 하세요.

   1. `AmazonRekognitionFullAccess` 권한과 `AmazonS3ReadOnlyAccess` 권한을 가진 사용자를 생성하거나 업데이트합니다. 자세한 내용은 [1단계: AWS 계정 설정 및 사용자 생성](setting-up.md#setting-up-iam) 단원을 참조하십시오.

   1.  AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 내용은 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md) 단원을 참조하십시오.

1. 다음 예제를 사용하여 `RecognizeCelebrities` 작업을 호출합니다.

------
#### [ Java ]

   이 예제는 이미지에서 감지된 유명 인사에 대한 정보를 표시합니다.

   `photo`의 값을, 하나 이상의 유명 인사 얼굴을 포함하는 이미지 파일의 경로와 파일 이름으로 변경합니다.

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   package aws.example.rekognition.image;
   import com.amazonaws.services.rekognition.AmazonRekognition;
   import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder;
   import com.amazonaws.services.rekognition.model.Image;
   import com.amazonaws.services.rekognition.model.BoundingBox;
   import com.amazonaws.services.rekognition.model.Celebrity;
   import com.amazonaws.services.rekognition.model.RecognizeCelebritiesRequest;
   import com.amazonaws.services.rekognition.model.RecognizeCelebritiesResult;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.InputStream;
   import java.nio.ByteBuffer;
   import com.amazonaws.util.IOUtils;
   import java.util.List;
   
   
   public class RecognizeCelebrities {
   
      public static void main(String[] args) {
         String photo = "moviestars.jpg";
   
         AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
   
         ByteBuffer imageBytes=null;
         try (InputStream inputStream = new FileInputStream(new File(photo))) {
            imageBytes = ByteBuffer.wrap(IOUtils.toByteArray(inputStream));
         }
         catch(Exception e)
         {
             System.out.println("Failed to load file " + photo);
             System.exit(1);
         }
   
   
         RecognizeCelebritiesRequest request = new RecognizeCelebritiesRequest()
            .withImage(new Image()
            .withBytes(imageBytes));
   
         System.out.println("Looking for celebrities in image " + photo + "\n");
   
         RecognizeCelebritiesResult result=rekognitionClient.recognizeCelebrities(request);
   
         //Display recognized celebrity information
         List<Celebrity> celebs=result.getCelebrityFaces();
         System.out.println(celebs.size() + " celebrity(s) were recognized.\n");
   
         for (Celebrity celebrity: celebs) {
             System.out.println("Celebrity recognized: " + celebrity.getName());
             System.out.println("Celebrity ID: " + celebrity.getId());
             BoundingBox boundingBox=celebrity.getFace().getBoundingBox();
             System.out.println("position: " +
                boundingBox.getLeft().toString() + " " +
                boundingBox.getTop().toString());
             System.out.println("Further information (if available):");
             for (String url: celebrity.getUrls()){
                System.out.println(url);
             }
             System.out.println();
          }
          System.out.println(result.getUnrecognizedFaces().size() + " face(s) were unrecognized.");
      }
   }
   ```

------
#### [ Java V2 ]

   이 코드는 AWS 설명서 SDK 예제 GitHub 리포지토리에서 가져온 것입니다. 전체 예제는 [여기](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/rekognition/src/main/java/com/example/rekognition/RecognizeCelebrities.java)에서 확인하세요.

   ```
   //snippet-start:[rekognition.java2.recognize_celebs.import]
   import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.rekognition.RekognitionClient;
   import software.amazon.awssdk.core.SdkBytes;
   import java.io.FileInputStream;
   import java.io.FileNotFoundException;
   import java.io.InputStream;
   import java.util.List;
   import software.amazon.awssdk.services.rekognition.model.RecognizeCelebritiesRequest;
   import software.amazon.awssdk.services.rekognition.model.RecognizeCelebritiesResponse;
   import software.amazon.awssdk.services.rekognition.model.RekognitionException;
   import software.amazon.awssdk.services.rekognition.model.Image;
   import software.amazon.awssdk.services.rekognition.model.Celebrity;
   //snippet-end:[rekognition.java2.recognize_celebs.import]
   
   /**
   * Before running this Java V2 code example, set up your development environment, including your credentials.
   *
   * For more information, see the following documentation topic:
   *
   * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
   */
   public class RecognizeCelebrities {
   
    public static void main(String[] args) {
   
        final String usage = "\n" +
            "Usage: " +
            "   <sourceImage>\n\n" +
            "Where:\n" +
            "   sourceImage - The path to the image (for example, C:\\AWS\\pic1.png). \n\n";
   
        if (args.length != 1) {
            System.out.println(usage);
            System.exit(1);
        }
   
        String sourceImage = args[0];
        Region region = Region.US_EAST_1;
        RekognitionClient rekClient = RekognitionClient.builder()
            .region(region)
            .credentialsProvider(ProfileCredentialsProvider.create("profile-name"))
            .build();
   
        System.out.println("Locating celebrities in " + sourceImage);
        recognizeAllCelebrities(rekClient, sourceImage);
        rekClient.close();
    }
   
    // snippet-start:[rekognition.java2.recognize_celebs.main]
    public static void recognizeAllCelebrities(RekognitionClient rekClient, String sourceImage) {
   
        try {
            InputStream sourceStream = new FileInputStream(sourceImage);
            SdkBytes sourceBytes = SdkBytes.fromInputStream(sourceStream);
            Image souImage = Image.builder()
                .bytes(sourceBytes)
                .build();
   
            RecognizeCelebritiesRequest request = RecognizeCelebritiesRequest.builder()
                .image(souImage)
                .build();
   
            RecognizeCelebritiesResponse result = rekClient.recognizeCelebrities(request) ;
            List<Celebrity> celebs=result.celebrityFaces();
            System.out.println(celebs.size() + " celebrity(s) were recognized.\n");
            for (Celebrity celebrity: celebs) {
                System.out.println("Celebrity recognized: " + celebrity.name());
                System.out.println("Celebrity ID: " + celebrity.id());
   
                System.out.println("Further information (if available):");
                for (String url: celebrity.urls()){
                    System.out.println(url);
                }
                System.out.println();
            }
            System.out.println(result.unrecognizedFaces().size() + " face(s) were unrecognized.");
   
        } catch (RekognitionException | FileNotFoundException e) {
            System.out.println(e.getMessage());
            System.exit(1);
        }
    }
    // snippet-end:[rekognition.java2.recognize_celebs.main]
   }
   ```

------
#### [ AWS CLI ]

   이 AWS CLI 명령은 `recognize-celebrities` CLI 작업에 대한 JSON 출력을 표시합니다.

   `amzn-s3-demo-bucket`을 이미지가 저장된 Amazon S3 버킷의 이름으로 변경합니다. `input.jpg`를 하나 이상의 유명 인사 얼굴을 포함하는 이미지 파일의 이름으로 변경합니다.

    `profile_name`의 값을 개발자 프로필 이름으로 바꿉니다.

   ```
   aws rekognition recognize-celebrities \
     --image "S3Object={Bucket=amzn-s3-demo-bucket,Name=input.jpg}"
   ```

    Windows 디바이스에서 CLI에 액세스하는 경우 작은따옴표 대신 큰따옴표를 사용하고 내부 큰따옴표는 백슬래시(즉 \$1)로 이스케이프 처리하여 발생할 수 있는 구문 분석 오류를 해결합니다. 예를 들어 다음을 참조하세요.

   ```
                                       aws rekognition recognize-celebrities --image \
                                       "{\"S3Object\":{\"Bucket\":\"amzn-s3-demo-bucket\",\"Name\":\"image-name\"}}" --profile profile-name
   ```

------
#### [ Python ]

   이 예제는 이미지에서 감지된 유명 인사에 대한 정보를 표시합니다.

   `photo`의 값을, 하나 이상의 유명 인사 얼굴을 포함하는 이미지 파일의 경로와 파일 이름으로 변경합니다.

   Rekognition 세션을 생성하는 라인에서 `profile_name`의 값을 개발자 프로필의 이름으로 대체합니다.

   ```
   #Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   #PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   import boto3
   
   def recognize_celebrities(photo):
       
       session = boto3.Session(profile_name='profile-name')
       client = session.client('rekognition')
   
       with open(photo, 'rb') as image:
           response = client.recognize_celebrities(Image={'Bytes': image.read()})
   
       print('Detected faces for ' + photo)
       for celebrity in response['CelebrityFaces']:
           print('Name: ' + celebrity['Name'])
           print('Id: ' + celebrity['Id'])
           print('KnownGender: ' + celebrity['KnownGender']['Type'])
           print('Smile: ' + str(celebrity['Face']['Smile']['Value']))
           print('Position:')
           print('   Left: ' + '{:.2f}'.format(celebrity['Face']['BoundingBox']['Height']))
           print('   Top: ' + '{:.2f}'.format(celebrity['Face']['BoundingBox']['Top']))
           print('Info')
           for url in celebrity['Urls']:
               print('   ' + url)
           print()
       return len(response['CelebrityFaces'])
   
   def main():
       photo = 'photo-name'
       celeb_count = recognize_celebrities(photo)
       print("Celebrities detected: " + str(celeb_count))
   
   if __name__ == "__main__":
       main()
   ```

------
#### [ Node.Js ]

   이 예제는 이미지에서 감지된 유명 인사에 대한 정보를 표시합니다.

   `photo`의 값을, 하나 이상의 유명 인사 얼굴을 포함하는 이미지 파일의 경로와 파일 이름으로 변경합니다. `amzn-s3-demo-bucket`의 값을 제공된 이미지 파일이 저장된 S3 버킷의 이름으로 바꿉니다. `REGION`의 값을 사용자와 연결된 지역 이름으로 변경합니다. Rekognition 세션을 생성하는 라인에서 `profile_name`의 값을 개발자 프로필의 이름으로 대체합니다.

   ```
   // Import required AWS SDK clients and commands for Node.js
   import { RecognizeCelebritiesCommand } from  "@aws-sdk/client-rekognition";
   import  { RekognitionClient } from "@aws-sdk/client-rekognition";
   
   // Set the AWS Region.
   const REGION = "region-name"; //e.g. "us-east-1"
   const profileName = "profile-name";
   
   // Create SNS service object.
   const rekogClient = new RekognitionClient({region: REGION, 
     credentials: fromIni({profile: profileName,}), 
   });
   
   const bucket = 'bucket-name'
   const photo = 'photo-name'
   
   // Set params
   const params = {
       Image: {
         S3Object: {
           Bucket: bucket,
           Name: photo
         },
       },
     }
   
   const recognize_celebrity = async() => {
       try {
           const response = await rekogClient.send(new RecognizeCelebritiesCommand(params));
           console.log(response.Labels)
           response.CelebrityFaces.forEach(celebrity =>{
               console.log(`Name: ${celebrity.Name}`)
               console.log(`ID: ${celebrity.Id}`)
               console.log(`KnownGender: ${celebrity.KnownGender.Type}`)
               console.log(`Smile: ${celebrity.Smile}`)
               console.log('Position: ')
               console.log(`   Left: ${celebrity.Face.BoundingBox.Height}`)
               console.log(`  Top : ${celebrity.Face.BoundingBox.Top}`)
               
           })
           return response.length; // For unit tests.
         } catch (err) {
           console.log("Error", err);
         }
   }
   
   recognize_celebrity()
   ```

------
#### [ .NET ]

   이 예제는 이미지에서 감지된 유명 인사에 대한 정보를 표시합니다.

   `photo`의 값을, 하나 이상의 유명 인사 얼굴(.jpg 또는 .png 형식)을 포함하는 이미지 파일의 경로와 파일 이름으로 변경합니다.

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   using System;
   using System.IO;
   using Amazon.Rekognition;
   using Amazon.Rekognition.Model;
   
   public class CelebritiesInImage
   {
       public static void Example()
       {
           String photo = "moviestars.jpg";
   
           AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient();
   
           RecognizeCelebritiesRequest recognizeCelebritiesRequest = new RecognizeCelebritiesRequest();
   
           Amazon.Rekognition.Model.Image img = new Amazon.Rekognition.Model.Image();
           byte[] data = null;
           try
           {
               using (FileStream fs = new FileStream(photo, FileMode.Open, FileAccess.Read))
               {
                   data = new byte[fs.Length];
                   fs.Read(data, 0, (int)fs.Length);
               }
           }
           catch(Exception)
           {
               Console.WriteLine("Failed to load file " + photo);
               return;
           }
   
           img.Bytes = new MemoryStream(data);
           recognizeCelebritiesRequest.Image = img;
   
           Console.WriteLine("Looking for celebrities in image " + photo + "\n");
   
           RecognizeCelebritiesResponse recognizeCelebritiesResponse = rekognitionClient.RecognizeCelebrities(recognizeCelebritiesRequest);
   
           Console.WriteLine(recognizeCelebritiesResponse.CelebrityFaces.Count + " celebrity(s) were recognized.\n");
           foreach (Celebrity celebrity in recognizeCelebritiesResponse.CelebrityFaces)
           {
               Console.WriteLine("Celebrity recognized: " + celebrity.Name);
               Console.WriteLine("Celebrity ID: " + celebrity.Id);
               BoundingBox boundingBox = celebrity.Face.BoundingBox;
               Console.WriteLine("position: " +
                  boundingBox.Left + " " + boundingBox.Top);
               Console.WriteLine("Further information (if available):");
               foreach (String url in celebrity.Urls)
                   Console.WriteLine(url);
           }
           Console.WriteLine(recognizeCelebritiesResponse.UnrecognizedFaces.Count + " face(s) were unrecognized.");
       }
   }
   ```

------

1. 표시되는 유명 인사 ID 중 하나의 값을 기록합니다. [유명 인사에 대한 정보 얻기](get-celebrity-info-procedure.md)에서 이 값이 필요할 것입니다.

## RecognizeCelebrities 작업 요청
<a name="recognizecelebrities-request"></a>

`RecognizeCelebrities`에 대한 입력은 이미지입니다. 이 예에서는 이미지가 이미지 바이트로 전달됩니다. 자세한 내용은 [이미지 작업](images.md) 단원을 참조하십시오.

```
{
    "Image": {
        "Bytes": "/AoSiyvFpm....."
    }
}
```

## RecognizeCelebrities 작업 응답
<a name="recognizecelebrities-response"></a>

다음은 `RecognizeCelebrities`에 대한 예제 JSON 입력 및 출력입니다.

`RecognizeCelebrities`는 인식된 유명 인사의 배열과 인식되지 않는 얼굴의 배열을 반환합니다. 예제에서 다음 사항에 유의하십시오.
+ **인식된 유명 인사** – `Celebrities`는 인식된 유명 인사의 배열입니다. 배열의 각 [Celebrity](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_Celebritiy.html) 객체에는 유명 인사 이름과 관련 콘텐츠를 가리키는 URL 목록(예: 유명인의 IMDB 또는 Wikidata 링크)이 포함됩니다. Amazon Rekognition은 애플리케이션이 이미지에서 유명 인사의 얼굴 위치를 확인하는 데 사용할 수 있는 [ComparedFace](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_ComparedFace.html) 객체와 유명 인사의 고유 식별자를 반환합니다. 나중에 [GetCelebrityInfo](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetCelebrityInfo.html) API 작업으로 유명 인사 정보를 검색하려면 이 고유한 식별자를 사용합니다.
+ **인식되지 않는 얼굴** – `UnrecognizedFaces`는 알려진 유명 인사 누구와도 일치하지 않는 얼굴의 배열입니다. 배열의 각 [ComparedFace](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_ComparedFace.html) 객체에는 이미지 속에서 얼굴을 찾는 데 사용할 수 있는 경계 상자가(기타 정보와 함께) 포함되어 있습니다.

```
{
    "CelebrityFaces": [{
        "Face": {
            "BoundingBox": {
                "Height": 0.617123007774353,
                "Left": 0.15641026198863983,
                "Top": 0.10864841192960739,
                "Width": 0.3641025722026825
            },
            "Confidence": 99.99589538574219,
            "Emotions": [{
                "Confidence": 96.3981749057023,
                "Type": "Happy"
                }
            ],
            "Landmarks": [{
                "Type": "eyeLeft",
                "X": 0.2837241291999817,
                "Y": 0.3637104034423828
            }, {
                "Type": "eyeRight",
                "X": 0.4091649055480957,
                "Y": 0.37378931045532227
            }, {
                "Type": "nose",
                "X": 0.35267341136932373,
                "Y": 0.49657556414604187
            }, {
                "Type": "mouthLeft",
                "X": 0.2786353826522827,
                "Y": 0.5455248355865479
            }, {
                "Type": "mouthRight",
                "X": 0.39566439390182495,
                "Y": 0.5597742199897766
            }],
            "Pose": {
                "Pitch": -7.749263763427734,
                "Roll": 2.004552125930786,
                "Yaw": 9.012002944946289
            },
            "Quality": {
                "Brightness": 32.69192123413086,
                "Sharpness": 99.9305191040039
            },
            "Smile": {
            "Confidence": 95.45394855702342,
            "Value": True
            }    
        },
        "Id": "3Ir0du6",
        "KnownGender": {
            "Type": "Male"
        },
        "MatchConfidence": 98.0,
        "Name": "Jeff Bezos",
        "Urls": ["www.imdb.com/name/nm1757263"]
    }],
    "OrientationCorrection": "NULL",
    "UnrecognizedFaces": [{
        "BoundingBox": {
            "Height": 0.5345501899719238,
            "Left": 0.48461538553237915,
            "Top": 0.16949152946472168,
            "Width": 0.3153846263885498
        },
        "Confidence": 99.92860412597656,
        "Landmarks": [{
            "Type": "eyeLeft",
            "X": 0.5863404870033264,
            "Y": 0.36940744519233704
        }, {
            "Type": "eyeRight",
            "X": 0.6999204754829407,
            "Y": 0.3769848346710205
        }, {
            "Type": "nose",
            "X": 0.6349524259567261,
            "Y": 0.4804527163505554
        }, {
            "Type": "mouthLeft",
            "X": 0.5872702598571777,
            "Y": 0.5535582304000854
        }, {
            "Type": "mouthRight",
            "X": 0.6952020525932312,
            "Y": 0.5600858926773071
        }],
        "Pose": {
            "Pitch": -7.386096477508545,
            "Roll": 2.304218292236328,
            "Yaw": -6.175624370574951
        },
        "Quality": {
            "Brightness": 37.16635513305664,
            "Sharpness": 99.9305191040039
        },
        "Smile": {
            "Confidence": 95.45394855702342,
            "Value": True
        }
    }]
}
```

# 저장된 동영상 속 유명 인사 인식
<a name="celebrities-video-sqs"></a>

Amazon Rekognition Video의 저장된 동영상 속 유명 인사 인식은 비동기 작업입니다. 저장된 동영상에서 유명 인사를 인식하려면 [StartCelebrityRecognition](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartCelebrityRecognition.html)을 사용하여 동영상 분석을 시작하세요. Amazon Rekognition Video는 비디오 분석의 완료 상태를 Amazon Simple Notification Service 주제에 게시합니다. 동영상 분석이 성공적으로 완료되면 [GetCelebrityRecognition](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetCelebrityRecognition.html)을 직접 호출하여 분석 결과를 가져옵니다. 비디오 분석 시작 및 결과 가져오기에 대한 자세한 내용은 [Amazon Rekognition Video 작업 직접 호출](api-video.md) 단원을 참조하십시오.

이 절차는 동영상 분석 요청의 완료 상태를 가져오기 위해 Amazon SQS 대기열을 사용하는 [Java 또는 Python으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](video-analyzing-with-sqs.md)의 코드를 확장합니다. 이 절차를 실행하려면 한 명 이상의 유명 인사 얼굴이 포함된 비디오 파일이 필요합니다.

**Amazon S3 버킷(SDK)에 저장된 동영상에서 유명 인사를 감지하려면**

1. [Java 또는 Python으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](video-analyzing-with-sqs.md)을 수행합니다.

1. 1단계에서 만든 클래스 `VideoDetect`에 다음 코드를 추가합니다.

------
#### [ Java ]

   ```
           //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
           //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
         // Celebrities=====================================================================
         private static void StartCelebrityDetection(String bucket, String video) throws Exception{
       	  
               NotificationChannel channel= new NotificationChannel()
                       .withSNSTopicArn(snsTopicArn)
                       .withRoleArn(roleArn);
     
              StartCelebrityRecognitionRequest req = new StartCelebrityRecognitionRequest()
                    .withVideo(new Video()
                          .withS3Object(new S3Object()
                                .withBucket(bucket)
                                .withName(video)))
                    .withNotificationChannel(channel);
     
     
     
              StartCelebrityRecognitionResult startCelebrityRecognitionResult = rek.startCelebrityRecognition(req);
              startJobId=startCelebrityRecognitionResult.getJobId();
     
           } 
     
           private static void GetCelebrityDetectionResults() throws Exception{
     
              int maxResults=10;
              String paginationToken=null;
              GetCelebrityRecognitionResult celebrityRecognitionResult=null;
     
              do{
                 if (celebrityRecognitionResult !=null){
                    paginationToken = celebrityRecognitionResult.getNextToken();
                 }
                 celebrityRecognitionResult = rek.getCelebrityRecognition(new GetCelebrityRecognitionRequest()
                       .withJobId(startJobId)
                       .withNextToken(paginationToken)
                       .withSortBy(CelebrityRecognitionSortBy.TIMESTAMP)
                       .withMaxResults(maxResults));
     
     
                 System.out.println("File info for page");
                 VideoMetadata videoMetaData=celebrityRecognitionResult.getVideoMetadata();
     
                 System.out.println("Format: " + videoMetaData.getFormat());
                 System.out.println("Codec: " + videoMetaData.getCodec());
                 System.out.println("Duration: " + videoMetaData.getDurationMillis());
                 System.out.println("FrameRate: " + videoMetaData.getFrameRate());
     
                 System.out.println("Job");
     
                 System.out.println("Job status: " + celebrityRecognitionResult.getJobStatus());
     
     
                 //Show celebrities
                 List<CelebrityRecognition> celebs= celebrityRecognitionResult.getCelebrities();
     
                 for (CelebrityRecognition celeb: celebs) { 
                    long seconds=celeb.getTimestamp()/1000;
                    System.out.print("Sec: " + Long.toString(seconds) + " ");
                    CelebrityDetail details=celeb.getCelebrity();
                    System.out.println("Name: " + details.getName());
                    System.out.println("Id: " + details.getId());
                    System.out.println(); 
                 }
              } while (celebrityRecognitionResult !=null && celebrityRecognitionResult.getNextToken() != null);
     
           }
   ```

   `main` 함수에서 다음 줄을 

   ```
           StartLabelDetection(amzn-s3-demo-bucket, video);
   
           if (GetSQSMessageSuccess()==true)
           	GetLabelDetectionResults();
   ```

   다음으로 바꿉니다.

   ```
           StartCelebrityDetection(amzn-s3-demo-bucket, video);
   
           if (GetSQSMessageSuccess()==true)
           	GetCelebrityDetectionResults();
   ```

------
#### [ Java V2 ]

   이 코드는 AWS 설명서 SDK 예제 GitHub 리포지토리에서 가져온 것입니다. 전체 예제는 [여기](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/rekognition/src/main/java/com/example/rekognition/VideoCelebrityDetection.java)에서 확인하세요.

   ```
   //snippet-start:[rekognition.java2.recognize_video_celebrity.import]
   import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider;
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.rekognition.RekognitionClient;
   import software.amazon.awssdk.services.rekognition.model.S3Object;
   import software.amazon.awssdk.services.rekognition.model.NotificationChannel;
   import software.amazon.awssdk.services.rekognition.model.Video;
   import software.amazon.awssdk.services.rekognition.model.StartCelebrityRecognitionResponse;
   import software.amazon.awssdk.services.rekognition.model.RekognitionException;
   import software.amazon.awssdk.services.rekognition.model.CelebrityRecognitionSortBy;
   import software.amazon.awssdk.services.rekognition.model.VideoMetadata;
   import software.amazon.awssdk.services.rekognition.model.CelebrityRecognition;
   import software.amazon.awssdk.services.rekognition.model.CelebrityDetail;
   import software.amazon.awssdk.services.rekognition.model.StartCelebrityRecognitionRequest;
   import software.amazon.awssdk.services.rekognition.model.GetCelebrityRecognitionRequest;
   import software.amazon.awssdk.services.rekognition.model.GetCelebrityRecognitionResponse;
   import java.util.List;
   //snippet-end:[rekognition.java2.recognize_video_celebrity.import]
   
   /**
   *  To run this code example, ensure that you perform the Prerequisites as stated in the Amazon Rekognition Guide:
   *  https://docs.aws.amazon.com/rekognition/latest/dg/video-analyzing-with-sqs.html
   *
   * Also, ensure that set up your development environment, including your credentials.
   *
   * For information, see this documentation topic:
   *
   * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
   */
   
   public class RecognizeCelebritiesVideo {
   
   private static String startJobId ="";
   
   public static void main(String[] args) {
   
      final String usage = "\n" +
          "Usage: " +
          "   <bucket> <video> <topicArn> <roleArn>\n\n" +
          "Where:\n" +
          "   bucket - The name of the bucket in which the video is located (for example, (for example, amzn-s3-demo-bucket). \n\n"+
          "   video - The name of video (for example, people.mp4). \n\n" +
          "   topicArn - The ARN of the Amazon Simple Notification Service (Amazon SNS) topic. \n\n" +
          "   roleArn - The ARN of the AWS Identity and Access Management (IAM) role to use. \n\n" ;
   
      if (args.length != 4) {
          System.out.println(usage);
          System.exit(1);
      }
   
      String bucket = args[0];
      String video = args[1];
      String topicArn = args[2];
      String roleArn = args[3];
      Region region = Region.US_EAST_1;
      RekognitionClient rekClient = RekognitionClient.builder()
          .region(region)
          .credentialsProvider(ProfileCredentialsProvider.create("profile-name"))
          .build();
   
     NotificationChannel channel = NotificationChannel.builder()
          .snsTopicArn(topicArn)
          .roleArn(roleArn)
          .build();
   
     StartCelebrityDetection(rekClient, channel, bucket, video);
     GetCelebrityDetectionResults(rekClient);
     System.out.println("This example is done!");
     rekClient.close();
   }
   
   // snippet-start:[rekognition.java2.recognize_video_celebrity.main]
   public static void StartCelebrityDetection(RekognitionClient rekClient,
                                              NotificationChannel channel,
                                              String bucket,
                                              String video){
      try {
          S3Object s3Obj = S3Object.builder()
              .bucket(bucket)
              .name(video)
              .build();
   
          Video vidOb = Video.builder()
              .s3Object(s3Obj)
              .build();
   
          StartCelebrityRecognitionRequest recognitionRequest = StartCelebrityRecognitionRequest.builder()
              .jobTag("Celebrities")
              .notificationChannel(channel)
              .video(vidOb)
              .build();
   
          StartCelebrityRecognitionResponse startCelebrityRecognitionResult = rekClient.startCelebrityRecognition(recognitionRequest);
          startJobId = startCelebrityRecognitionResult.jobId();
   
      } catch(RekognitionException e) {
          System.out.println(e.getMessage());
          System.exit(1);
      }
   }
   
   public static void GetCelebrityDetectionResults(RekognitionClient rekClient) {
   
      try {
          String paginationToken=null;
          GetCelebrityRecognitionResponse recognitionResponse = null;
          boolean finished = false;
          String status;
          int yy=0 ;
   
          do{
              if (recognitionResponse !=null)
                  paginationToken = recognitionResponse.nextToken();
   
              GetCelebrityRecognitionRequest recognitionRequest = GetCelebrityRecognitionRequest.builder()
                  .jobId(startJobId)
                  .nextToken(paginationToken)
                  .sortBy(CelebrityRecognitionSortBy.TIMESTAMP)
                  .maxResults(10)
                  .build();
   
              // Wait until the job succeeds
              while (!finished) {
                  recognitionResponse = rekClient.getCelebrityRecognition(recognitionRequest);
                  status = recognitionResponse.jobStatusAsString();
   
                  if (status.compareTo("SUCCEEDED") == 0)
                      finished = true;
                  else {
                      System.out.println(yy + " status is: " + status);
                      Thread.sleep(1000);
                  }
                  yy++;
              }
   
              finished = false;
   
              // Proceed when the job is done - otherwise VideoMetadata is null.
              VideoMetadata videoMetaData=recognitionResponse.videoMetadata();
              System.out.println("Format: " + videoMetaData.format());
              System.out.println("Codec: " + videoMetaData.codec());
              System.out.println("Duration: " + videoMetaData.durationMillis());
              System.out.println("FrameRate: " + videoMetaData.frameRate());
              System.out.println("Job");
   
              List<CelebrityRecognition> celebs= recognitionResponse.celebrities();
              for (CelebrityRecognition celeb: celebs) {
                  long seconds=celeb.timestamp()/1000;
                  System.out.print("Sec: " + seconds + " ");
                  CelebrityDetail details=celeb.celebrity();
                  System.out.println("Name: " + details.name());
                  System.out.println("Id: " + details.id());
                  System.out.println();
              }
   
          } while (recognitionResponse.nextToken() != null);
   
      } catch(RekognitionException | InterruptedException e) {
          System.out.println(e.getMessage());
          System.exit(1);
      }
   }
   // snippet-end:[rekognition.java2.recognize_video_celebrity.main]
   }
   ```

------
#### [ Python ]

   ```
   #Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   #PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
       # ============== Celebrities ===============
       def StartCelebrityDetection(self):
           response=self.rek.start_celebrity_recognition(Video={'S3Object': {'Bucket': self.bucket, 'Name': self.video}},
               NotificationChannel={'RoleArn': self.roleArn, 'SNSTopicArn': self.snsTopicArn})
   
           self.startJobId=response['JobId']
           print('Start Job Id: ' + self.startJobId)
   
       def GetCelebrityDetectionResults(self):
           maxResults = 10
           paginationToken = ''
           finished = False
   
           while finished == False:
               response = self.rek.get_celebrity_recognition(JobId=self.startJobId,
                                                       MaxResults=maxResults,
                                                       NextToken=paginationToken)
   
               print(response['VideoMetadata']['Codec'])
               print(str(response['VideoMetadata']['DurationMillis']))
               print(response['VideoMetadata']['Format'])
               print(response['VideoMetadata']['FrameRate'])
   
               for celebrityRecognition in response['Celebrities']:
                   print('Celebrity: ' +
                       str(celebrityRecognition['Celebrity']['Name']))
                   print('Timestamp: ' + str(celebrityRecognition['Timestamp']))
                   print()
   
               if 'NextToken' in response:
                   paginationToken = response['NextToken']
               else:
                   finished = True
   ```

   `main` 함수에서 다음 줄을 바꿉니다.

   ```
       analyzer.StartLabelDetection()
       if analyzer.GetSQSMessageSuccess()==True:
           analyzer.GetLabelDetectionResults()
   ```

   다음으로 바꿉니다.

   ```
       analyzer.StartCelebrityDetection()
       if analyzer.GetSQSMessageSuccess()==True:
           analyzer.GetCelebrityDetectionResults()
   ```

------
#### [ Node.JS ]

   다음 Node.Js 코드 예제에서 `amzn-s3-demo-bucket`의 값을 동영상이 포함된 S3 버킷의 이름으로 바꾸고 `videoName`의 값을 해당 동영상 파일의 이름으로 바꾸세요. 또한 `roleArn`의 값을 IAM 서비스 역할에 연결된 Arn으로 바꿔야 합니다. 마지막으로 `region`의 값을 귀하의 계정과 연결된 운영 리전의 이름으로 바꾸세요. Rekognition 세션을 생성하는 라인에서 `profile_name`의 값을 개발자 프로필의 이름으로 대체합니다.

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   // Import required AWS SDK clients and commands for Node.js
   import { CreateQueueCommand, GetQueueAttributesCommand, GetQueueUrlCommand, 
     SetQueueAttributesCommand, DeleteQueueCommand, ReceiveMessageCommand, DeleteMessageCommand } from  "@aws-sdk/client-sqs";
   import {CreateTopicCommand, SubscribeCommand, DeleteTopicCommand } from "@aws-sdk/client-sns";
   import  { SQSClient } from "@aws-sdk/client-sqs";
   import  { SNSClient } from "@aws-sdk/client-sns";
   import  { RekognitionClient, StartLabelDetectionCommand, GetLabelDetectionCommand, 
     StartCelebrityRecognitionCommand, GetCelebrityRecognitionCommand} from "@aws-sdk/client-rekognition";
   import { stdout } from "process";
   import {fromIni} from '@aws-sdk/credential-providers';
   
   // Set the AWS Region.
   const REGION = "region-name"; //e.g. "us-east-1"
   // Set the profile name
   const profileName = "profile-name"
   // Name the collection
   // Create SNS service object.
   const sqsClient = new SQSClient({ region: REGION, 
     credentials: fromIni({profile: profileName,}), });
   const snsClient = new SNSClient({ region: REGION, 
     credentials: fromIni({profile: profileName,}), });
   const rekClient = new RekognitionClient({region: REGION, 
     credentials: fromIni({profile: profileName,}), 
   });
   
   // Set bucket and video variables
   const bucket = "bucket-name";
   const videoName = "video-name";
   const roleArn = "role-arn"
   var startJobId = ""
   
   var ts = Date.now();
   const snsTopicName = "AmazonRekognitionExample" + ts;
   const snsTopicParams = {Name: snsTopicName}
   const sqsQueueName = "AmazonRekognitionQueue-" + ts;
   
    // Set the parameters
    const sqsParams = {
     QueueName: sqsQueueName, //SQS_QUEUE_URL
     Attributes: {
       DelaySeconds: "60", // Number of seconds delay.
       MessageRetentionPeriod: "86400", // Number of seconds delay.
     },
   };
   
   const createTopicandQueue = async () => {
     try {
       // Create SNS topic
       const topicResponse = await snsClient.send(new CreateTopicCommand(snsTopicParams));
       const topicArn = topicResponse.TopicArn
       console.log("Success", topicResponse);
       // Create SQS Queue
       const sqsResponse = await sqsClient.send(new CreateQueueCommand(sqsParams));
       console.log("Success", sqsResponse);
       const sqsQueueCommand = await sqsClient.send(new GetQueueUrlCommand({QueueName: sqsQueueName}))
       const sqsQueueUrl = sqsQueueCommand.QueueUrl
       const attribsResponse = await sqsClient.send(new GetQueueAttributesCommand({QueueUrl: sqsQueueUrl, AttributeNames: ['QueueArn']}))
       const attribs = attribsResponse.Attributes
       console.log(attribs)
       const queueArn = attribs.QueueArn
       // subscribe SQS queue to SNS topic
       const subscribed = await snsClient.send(new SubscribeCommand({TopicArn: topicArn, Protocol:'sqs', Endpoint: queueArn}))
       const policy = {
         Version: "2012-10-17",&TCX5-2025-waiver;
         Statement: [
           {
             Sid: "MyPolicy",
             Effect: "Allow",
             Principal: {AWS: "*"},
             Action: "SQS:SendMessage",
             Resource: queueArn,
             Condition: {
               ArnEquals: {
                 'aws:SourceArn': topicArn
               }
             }
           }
         ]
       };
   
       const response = sqsClient.send(new SetQueueAttributesCommand({QueueUrl: sqsQueueUrl, Attributes: {Policy: JSON.stringify(policy)}}))
       console.log(response)
       console.log(sqsQueueUrl, topicArn)
       return [sqsQueueUrl, topicArn]
   
     } catch (err) {
       console.log("Error", err);
     }
   };
   
   const startCelebrityDetection = async(roleArn, snsTopicArn) =>{
     try {
         //Initiate label detection and update value of startJobId with returned Job ID
         const response = await rekClient.send(new StartCelebrityRecognitionCommand({Video:{S3Object:{Bucket:bucket, Name:videoName}},
             NotificationChannel:{RoleArn: roleArn, SNSTopicArn: snsTopicArn}}))
             startJobId = response.JobId
             console.log(`Start Job ID: ${startJobId}`)
             return startJobId
       } catch (err) {
         console.log("Error", err);
       }
     };
   
   const getCelebrityRecognitionResults = async(startJobId) =>{
     try {
         //Initiate label detection and update value of startJobId with returned Job ID
         var maxResults = 10
         var paginationToken = ''
         var finished = false
   
         while (finished == false){
             var response = await rekClient.send(new GetCelebrityRecognitionCommand({JobId: startJobId, MaxResults: maxResults, 
                 NextToken: paginationToken}))
             console.log(response.VideoMetadata.Codec)
             console.log(response.VideoMetadata.DurationMillis)
             console.log(response.VideoMetadata.Format)
             console.log(response.VideoMetadata.FrameRate)
             response.Celebrities.forEach(celebrityRecognition => {
                 console.log(`Celebrity: ${celebrityRecognition.Celebrity.Name}`)
                 console.log(`Timestamp: ${celebrityRecognition.Timestamp}`)
                 console.log()
             })
             // Searh for pagination token, if found, set variable to next token
             if (String(response).includes("NextToken")){
                 paginationToken = response.NextToken
         
             }else{
                 finished = true
             }
         }
       } catch (err) {
         console.log("Error", err);
       }
     };
   
   // Checks for status of job completion
   const getSQSMessageSuccess = async(sqsQueueUrl, startJobId) => {
     try {
       // Set job found and success status to false initially
       var jobFound = false
       var succeeded = false
       var dotLine = 0
       // while not found, continue to poll for response
       while (jobFound == false){
         var sqsReceivedResponse = await sqsClient.send(new ReceiveMessageCommand({QueueUrl:sqsQueueUrl, 
           MaxNumberOfMessages:'ALL', MaxNumberOfMessages:10}));
         if (sqsReceivedResponse){
           var responseString = JSON.stringify(sqsReceivedResponse)
           if (!responseString.includes('Body')){
             if (dotLine < 40) {
               console.log('.')
               dotLine = dotLine + 1
             }else {
               console.log('')
               dotLine = 0 
             };
             stdout.write('', () => {
               console.log('');
             });
             await new Promise(resolve => setTimeout(resolve, 5000));
             continue
           }
         }
   
         // Once job found, log Job ID and return true if status is succeeded
         for (var message of sqsReceivedResponse.Messages){
           console.log("Retrieved messages:")
           var notification = JSON.parse(message.Body)
           var rekMessage = JSON.parse(notification.Message)
           var messageJobId = rekMessage.JobId
           if (String(rekMessage.JobId).includes(String(startJobId))){
             console.log('Matching job found:')
             console.log(rekMessage.JobId)
             jobFound = true
             console.log(rekMessage.Status)
             if (String(rekMessage.Status).includes(String("SUCCEEDED"))){
               succeeded = true
               console.log("Job processing succeeded.")
               var sqsDeleteMessage = await sqsClient.send(new DeleteMessageCommand({QueueUrl:sqsQueueUrl, ReceiptHandle:message.ReceiptHandle}));
             }
           }else{
             console.log("Provided Job ID did not match returned ID.")
             var sqsDeleteMessage = await sqsClient.send(new DeleteMessageCommand({QueueUrl:sqsQueueUrl, ReceiptHandle:message.ReceiptHandle}));
           }
         }
       }
     return succeeded
     } catch(err) {
       console.log("Error", err);
     }
   };
   
   // Start label detection job, sent status notification, check for success status
   // Retrieve results if status is "SUCEEDED", delete notification queue and topic
   const runCelebRecognitionAndGetResults = async () => {
     try {
       const sqsAndTopic = await createTopicandQueue();
       //const startLabelDetectionRes = await startLabelDetection(roleArn, sqsAndTopic[1]);
       //const getSQSMessageStatus = await getSQSMessageSuccess(sqsAndTopic[0], startLabelDetectionRes)
       const startCelebrityDetectionRes = await startCelebrityDetection(roleArn, sqsAndTopic[1]);
       const getSQSMessageStatus = await getSQSMessageSuccess(sqsAndTopic[0], startCelebrityDetectionRes)
       console.log(getSQSMessageSuccess)
       if (getSQSMessageSuccess){
         console.log("Retrieving results:")
         const results = await getCelebrityRecognitionResults(startCelebrityDetectionRes)
       }
       const deleteQueue = await sqsClient.send(new DeleteQueueCommand({QueueUrl: sqsAndTopic[0]}));
       const deleteTopic = await snsClient.send(new DeleteTopicCommand({TopicArn: sqsAndTopic[1]}));
       console.log("Successfully deleted.")
     } catch (err) {
       console.log("Error", err);
     }
   };
   
   runCelebRecognitionAndGetResults()
   ```

------
#### [ CLI ]

   다음 AWS CLI 명령을 실행하여 비디오에서 유명 인사 감지를 시작합니다.

   ```
   aws rekognition start-celebrity-recognition --video "{"S3Object":{"Bucket":"amzn-s3-demo-bucket","Name":"video-name"}}" \
   --notification-channel "{"SNSTopicArn":"topic-arn","RoleArn":"role-arn"}" \
   --region region-name --profile profile-name
   ```

   다음 값을 업데이트합니다.
   + `amzn-s3-demo-bucket` 및 `video-name`을 2단계에서 지정한 Amazon S3 버킷 이름과 파일 이름으로 변경합니다.
   + `region-name`을 사용 중인 AWS 리전으로 변경합니다.
   + `profile-name`의 값을 개발자 프로필 이름으로 바꿉니다.
   + `topic-ARN`을 [Amazon Rekognition Video 구성](api-video-roles.md)의 3단계에서 생성한 Amazon SNS 주제의 ARN으로 변경합니다.
   + `role-ARN`을 [Amazon Rekognition Video 구성](api-video-roles.md)의 7단계에서 생성한 IAM 서비스 역할의 ARN으로 변경합니다.

   Windows 디바이스에서 CLI에 액세스하는 경우 작은따옴표 대신 큰따옴표를 사용하고 내부 큰따옴표는 백슬래시(즉 \$1)로 이스케이프 처리하여 발생할 수 있는 구문 분석 오류를 해결합니다. 예시를 보려면 다음을 참조하세요.

   ```
   aws rekognition start-celebrity-recognition --video "{\"S3Object\":{\"Bucket\":\"amzn-s3-demo-bucket\",\"Name\":\"video-name\"}}" \
   --notification-channel "{\"SNSTopicArn\":\"topic-arn\",\"RoleArn\":\"role-arn\"}" \
   --region region-name --profile profile-name
   ```

   진행 중인 코드 예제를 실행한 후 반환된 `jobID`를 복사하여 다음 `GetCelebrityRecognition` 명령에 제공하여 결과를 가져오고,`job-id-number`를 이전에 받은 `jobID`로 바꾸세요.

   ```
   aws rekognition get-celebrity-recognition --job-id job-id-number --profile profile-name                               
   ```

------
**참고**  
[Java 또는 Python으로 Amazon S3 버킷에 저장된 비디오 분석(SDK)](video-analyzing-with-sqs.md) 이외에 비디오 예제를 이미 실행한 경우, 바꿀 코드가 다를 수 있습니다.

1. 코드를 실행합니다. 비디오에서 인식된 유명 인사에 관한 정보가 표시됩니다.

## GetCelebrityRecognition 작업 응답
<a name="getcelebrityrecognition-operation-output"></a>

다음은 JSON 응답의 예입니다. 응답에는 다음이 포함됩니다.
+ **인식된 유명 인사** – `Celebrities`는 동영상 속 유명 인사의 배열과 인식된 시간입니다. 비디오에서 유명 인사가 인식되는 때마다 [CelebrityRecognition](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CelebrityRecognition.html) 객체가 존재합니다. 각 `CelebrityRecognition`에는 인식된 유명 인사([CelebrityDetail](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CelebrityDetail.html))와 해당 유명 인사가 비디오에서 인식된 시간(`Timestamp`)에 대한 정보가 포함되어 있습니다. `Timestamp`는 비디오가 시작된 순간부터 밀리초 단위로 측정됩니다.
+ **CelebrityDetail** – 인식된 유명 인사에 대한 정보가 들어 있습니다. 여기에는 유명 인사 이름(`Name`), 식별자(`ID`), 해당 유명 인사의 알려진 성별(`KnownGender`) 및 관련 콘텐츠를 가리키는 URL 목록(`Urls`)이 포함됩니다. 또한 Amazon Rekognition Video의 해당 인식에 대한 신뢰도 및 유명 인사의 얼굴인 [FaceDetail](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_FaceDetail.html)에 대한 세부 정보도 포함됩니다. 나중에 관련 콘텐츠를 가져와야 하는 경우 [getCelebrityInfo](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetCelebrityInfo.html)와 함께 `ID`를 사용할 수 있습니다.
+ **VideoMetadata** – 분석된 비디오에 관한 정보입니다.

```
{
    "Celebrities": [
        {
            "Celebrity": {
                "Confidence": 0.699999988079071,
                "Face": {
                    "BoundingBox": {
                        "Height": 0.20555555820465088,
                        "Left": 0.029374999925494194,
                        "Top": 0.22333332896232605,
                        "Width": 0.11562500149011612
                    },
                    "Confidence": 99.89837646484375,
                    "Landmarks": [
                        {
                            "Type": "eyeLeft",
                            "X": 0.06857934594154358,
                            "Y": 0.30842265486717224
                        },
                        {
                            "Type": "eyeRight",
                            "X": 0.10396526008844376,
                            "Y": 0.300625205039978
                        },
                        {
                            "Type": "nose",
                            "X": 0.0966852456331253,
                            "Y": 0.34081998467445374
                        },
                        {
                            "Type": "mouthLeft",
                            "X": 0.075217105448246,
                            "Y": 0.3811396062374115
                        },
                        {
                            "Type": "mouthRight",
                            "X": 0.10744428634643555,
                            "Y": 0.37407416105270386
                        }
                    ],
                    "Pose": {
                        "Pitch": -0.9784082174301147,
                        "Roll": -8.808176040649414,
                        "Yaw": 20.28228759765625
                    },
                    "Quality": {
                        "Brightness": 43.312068939208984,
                        "Sharpness": 99.9305191040039
                    }
                },
                "Id": "XXXXXX",
                "KnownGender": {
                    "Type": "Female"
                },
                "Name": "Celeb A",
                "Urls": []
            },
            "Timestamp": 367
       },......
    ],
    "JobStatus": "SUCCEEDED",
    "NextToken": "XfXnZKiyMOGDhzBzYUhS5puM+g1IgezqFeYpv/H/+5noP/LmM57FitUAwSQ5D6G4AB/PNwolrw==",
    "VideoMetadata": {
        "Codec": "h264",
        "DurationMillis": 67301,
        "FileExtension": "mp4",
        "Format": "QuickTime / MOV",
        "FrameHeight": 1080,
        "FrameRate": 29.970029830932617,
        "FrameWidth": 1920
    }
}
```

# 유명 인사에 대한 정보 얻기
<a name="get-celebrity-info-procedure"></a>

이 절차에서는 [getCelebrityInfo](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetCelebrityInfo.html) API 작업을 사용하여 유명 인사 정보를 얻습니다. 유명 인사는 이전 [RecognizeCelebrities](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_RecognizeCelebrities.html) 직접 호출에서 반환된 유명 인사 ID를 사용하여 식별됩니다.

## GetCelebrityInfo 호출
<a name="get-celebrity-info-examples"></a>



이 절차에는 Amazon Rekognition이 알고 있는 유명 인사의 유명 인사 ID가 필요합니다. [이미지 속 유명 인사 인식](celebrities-procedure-image.md)에서 기록해둔 유명 인사 ID를 사용합니다.

**유명 인사 정보를 획득하려면(SDK)**

1. 아직 설정하지 않았다면 다음과 같이 하세요.

   1. `AmazonRekognitionFullAccess` 권한과 `AmazonS3ReadOnlyAccess` 권한을 가진 사용자를 생성하거나 업데이트합니다. 자세한 내용은 [1단계: AWS 계정 설정 및 사용자 생성](setting-up.md#setting-up-iam) 단원을 참조하십시오.

   1.  AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 내용은 [2단계: AWS CLI 및 AWS SDKs 설정](setup-awscli-sdk.md) 단원을 참조하십시오.

1. 다음 예제를 사용하여 `GetCelebrityInfo` 작업을 호출합니다.

------
#### [ Java ]

   이 예제는 유명 인사의 이름과 정보를 표시합니다.

   `id`를 [이미지 속 유명 인사 인식](celebrities-procedure-image.md)에 표시된 유명 인사 ID 중 하나로 바꿉니다.

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   package aws.example.rekognition.image;
   import com.amazonaws.services.rekognition.AmazonRekognition;
   import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder;
   import com.amazonaws.services.rekognition.model.GetCelebrityInfoRequest;
   import com.amazonaws.services.rekognition.model.GetCelebrityInfoResult;
   
   
   public class CelebrityInfo {
   
      public static void main(String[] args) {
         String id = "nnnnnnnn";
   
         AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
   
         GetCelebrityInfoRequest request = new GetCelebrityInfoRequest()
            .withId(id);
   
         System.out.println("Getting information for celebrity: " + id);
   
         GetCelebrityInfoResult result=rekognitionClient.getCelebrityInfo(request);
   
         //Display celebrity information
         System.out.println("celebrity name: " + result.getName());
         System.out.println("Further information (if available):");
         for (String url: result.getUrls()){
            System.out.println(url);
         }
      }
   }
   ```

------
#### [ Java V2 ]

   이 코드는 AWS 설명서 SDK 예제 GitHub 리포지토리에서 가져온 것입니다. 전체 예제는 [여기](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/rekognition/src/main/java/com/example/rekognition/CelebrityInfo.java)에서 확인하세요.

   ```
   import software.amazon.awssdk.regions.Region;
   import software.amazon.awssdk.services.rekognition.RekognitionClient;
   import software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoRequest;
   import software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoResponse;
   import software.amazon.awssdk.services.rekognition.model.RekognitionException;
   
   /**
    * Before running this Java V2 code example, set up your development
    * environment, including your credentials.
    *
    * For more information, see the following documentation topic:
    *
    * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
    */
   public class CelebrityInfo {
       public static void main(String[] args) {
           final String usage = """
   
                   Usage:    <id>
   
                   Where:
                      id - The id value of the celebrity. You can use the RecognizeCelebrities example to get the ID value.\s
                   """;
   
           if (args.length != 1) {
               System.out.println(usage);
               System.exit(1);
           }
   
           String id = args[0];
           Region region = Region.US_WEST_2;
           RekognitionClient rekClient = RekognitionClient.builder()
                   .region(region)
                   .build();
   
           getCelebrityInfo(rekClient, id);
           rekClient.close();
       }
   
       /**
        * Retrieves information about a celebrity identified in an image.
        *
        * @param rekClient the Amazon Rekognition client used to make the API call
        * @param id the unique identifier of the celebrity
        * @throws RekognitionException if there is an error retrieving the celebrity information
        */
       public static void getCelebrityInfo(RekognitionClient rekClient, String id) {
           try {
               GetCelebrityInfoRequest info = GetCelebrityInfoRequest.builder()
                       .id(id)
                       .build();
   
               GetCelebrityInfoResponse response = rekClient.getCelebrityInfo(info);
               System.out.println("celebrity name: " + response.name());
               System.out.println("Further information (if available):");
               for (String url : response.urls()) {
                   System.out.println(url);
               }
   
           } catch (RekognitionException e) {
               System.out.println(e.getMessage());
               System.exit(1);
           }
       }
   }
   ```

------
#### [ AWS CLI ]

   이 AWS CLI 명령은 `get-celebrity-info` CLI 작업에 대한 JSON 출력을 표시합니다. `ID`를 [이미지 속 유명 인사 인식](celebrities-procedure-image.md)에 표시된 유명 인사 ID 중 하나로 바꿉니다. `profile-name`의 값을 개발자 프로필 이름으로 바꿉니다.

   ```
   aws rekognition get-celebrity-info --id celebrity-id --profile profile-name
   ```

------
#### [ Python ]

   이 예제는 유명 인사의 이름과 정보를 표시합니다.

   `id`를 [이미지 속 유명 인사 인식](celebrities-procedure-image.md)에 표시된 유명 인사 ID 중 하나로 바꿉니다. Rekognition 세션을 생성하는 라인에서 `profile_name`의 값을 개발자 프로필의 이름으로 대체합니다.

   ```
   # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   # PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   import boto3
   
   def get_celebrity_info(id):
   
       session = boto3.Session(profile_name='profile-name')
       client = session.client('rekognition')
   
       # Display celebrity info
       print('Getting celebrity info for celebrity: ' + id)
   
       response = client.get_celebrity_info(Id=id)
   
       print(response['Name'])
       print('Further information (if available):')
       for url in response['Urls']:
           print(url)
   
   def main():
       id = "celebrity-id"
       celebrity_info = get_celebrity_info(id)
   
   if __name__ == "__main__":
       main()
   ```

------
#### [ .NET ]

   이 예제는 유명 인사의 이름과 정보를 표시합니다.

   `id`를 [이미지 속 유명 인사 인식](celebrities-procedure-image.md)에 표시된 유명 인사 ID 중 하나로 바꿉니다.

   ```
   //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
   
   using System;
   using Amazon.Rekognition;
   using Amazon.Rekognition.Model;
   
   
   public class CelebrityInfo
   {
       public static void Example()
       {
           String id = "nnnnnnnn";
   
           AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient();
   
           GetCelebrityInfoRequest celebrityInfoRequest = new GetCelebrityInfoRequest()
           {
               Id = id
           };
   
           Console.WriteLine("Getting information for celebrity: " + id);
   
           GetCelebrityInfoResponse celebrityInfoResponse = rekognitionClient.GetCelebrityInfo(celebrityInfoRequest);
   
           //Display celebrity information
           Console.WriteLine("celebrity name: " + celebrityInfoResponse.Name);
           Console.WriteLine("Further information (if available):");
           foreach (String url in celebrityInfoResponse.Urls)
               Console.WriteLine(url);
       }
   }
   ```

------

## GetCelebrityInfo 작업 요청
<a name="getcelebrityinfo-operation-request"></a>

다음은 `GetCelebrityInfo`에 대한 예제 JSON 입력 및 출력입니다.

`GetCelebrityInfo`에 대한 입력은 해당 유명 인사의 ID입니다.

```
{
    "Id": "nnnnnnn"
}
```

## GetCelebrityInfo 작업 응답
<a name="getcelebrityinfo-operation-response"></a>

`GetCelebrityInfo`는 요청한 유명 인사의 정보에 대한 링크 배열(`Urls`)을 반환합니다.

```
{
    "Name": "Celebrity Name",
    "Urls": [
        "www.imdb.com/name/nmnnnnnnn"
    ]
}
```