

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 了解非儲存和儲存 API 操作
<a name="how-it-works-storage-non-storage"></a>

Amazon Rekognition 提供兩種類型的 API 操作。其中一種是非儲存操作，Amazon Rekognition 不會儲存資訊；另一種是儲存操作，Amazon Rekognition​ 會儲存特定人臉資訊。

## 非儲存操作
<a name="how-it-works-non-storage"></a>

Amazon Rekognition 提供以下用於映像的非儲存 API 操作：
+ [DetectLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectLabels.html)
+ [DetectFaces](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectFaces.html) 
+ [CompareFaces](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CompareFaces.html) 
+ [DetectModerationLabels](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectModerationLabels.html) 
+ [DetectProtectiveEquipment](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectProtectiveEquipment.html) 
+ [RecognizeCelebrities](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_RecognizeCelebrities.html) 
+ [DetectText](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectText.html) 
+ [GetCelebrityInfo](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_GetCelebrityInfo.html) 

Amazon Rekognition 提供以下用於影片的非儲存 API 操作：
+ [StartLabelDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartlabelDetection.html) 
+ [StartFaceDetection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartFaceDetection.html) 
+ [StartPersonTracking](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartPersonTracking.html)
+ [StartCelebrityRecognition](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartCelebrityRecognition.html)
+ [StartContentModeration](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartContentModeration.html)

這些稱為*非儲存* API 操作，因為當您執行操作呼叫時，Amazon Rekognition 不會保留任何從輸入映像中找到的任何相關資訊。與所有其他 Amazon Rekognition API 操作相同，非儲存 API 操作不會保留輸入映像位元組。

以下範例說明您在應用程式中可能採用非儲存 API 操作的情況。這些情況假設您有一個存放映像的本機儲存庫。

**Example 1：用於在包含特定標籤的本機儲存庫中尋找映像的應用程式**  
首先，在儲存庫內的每個映像中使用 Amazon Rekognition `DetectLabels` 操作來偵測標籤 (物件和概念)，並建置客戶端索引，如下所示：  

```
Label        ImageID

tree          image-1
flower        image-1
mountain      image-1
tulip         image-2
flower        image-2
apple         image-3
```
接著，您的應用程式可以搜尋這個索引來尋找在本機儲存庫中包含特定標籤的映像。例如，顯示出現樹的映像。  
每個 Amazon Rekognition 偵測的標籤都有相關的可信度數值。此分數顯示輸入映像內包含該標籤的可信度等級。您可以使用此可信度分數來選擇是否根據應用程式要求的偵測可信度等級來執行額外的客戶端標籤篩選。例如，如果您要求精確標籤，可篩選並選擇有較高可信度分數的標籤 (例如，95% 或更高分數)。如果您的應用程式未要求較高的可信度分數，您可以選擇篩選出有較低可信度分數的標籤 (接近於 50%)。

**Example 2：顯示強化人臉映像的應用程式**  
首先，可使用 Amazon Rekognition `DetectFaces` 操作來偵測本機儲存庫內每個映像中的人臉，並建置客戶端索引，如下所示：操作將傳回每個人臉的中繼資料，包含週框方塊、人臉特徵點 (例如嘴巴與耳朵的位置)、以及人臉屬性 (例如，性別)。您可以將此中繼資料儲存於客戶端本機索引，如下所示：  

```
ImageID     FaceID     FaceMetaData

image-1     face-1     <boundingbox>, etc.
image-1     face-2     <boundingbox>, etc.
image-1     face-3     <boundingbox>, etc.
...
```
在此索引中，主索引鑰為 `ImageID` 和 `FaceID` 的組合。  
接著，您可以使用索引中的資訊，在應用程式顯示來自本機儲存庫的映像時用以強化映像。例如，您可以加入臉部周圍的週框方塊或者強調臉部特徵。  
 

## 以儲存為基礎的 API 操作
<a name="how-it-works-storage-based"></a>

Amazon Rekognition Image 支援 [IndexFaces](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_IndexFaces.html) 操作，您可以使用此操作來偵測映像中臉孔，並保留在 Amazon Rekognition 集合中偵測到的人臉特徵資訊。此為*以儲存體為基礎*的 API 操作範例，因服務將在伺服器中保留資訊。

Amazon Rekognition Image 提供以下儲存 API 操作：
+ [IndexFaces](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_IndexFaces.html)
+ [ListFaces](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_ListFaces.html) 
+ [SearchFacesByImage](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_SearchFacesByImage.html) 
+ [SearchFaces](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_SearchFaces.html) 
+ [DeleteFaces](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DeleteFaces.html) 
+ [DescribeCollection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DescribeCollection.html) 
+ [DeleteCollection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DeleteCollection.html)
+ [ListCollections](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_ListCollections.html)
+ [CreateCollection](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateCollection.html) 

Amazon Rekognition Video 提供以下儲存 API 操作：
+ [StartFaceSearch](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartFaceSearch.html) 
+ [CreateStreamProcessor](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_CreateStreamProcessor.html)

若要儲存臉部資訊，您必須先在帳戶中其中一個 AWS 區域中建立臉部集合。當您呼叫 `IndexFaces` 操作時可指定此人臉集合。在建立臉孔集合並儲存所有臉孔的臉部特徵資訊後，即可搜尋集合來比對臉孔。例如，您可以呼叫 `searchFacesByImage.` 來偵測映像中最大的臉孔並在集合中搜尋相符的人臉

Amazon Rekognition Video 操作可存取 `IndexFaces` 儲存於集合中的人臉資訊。例如，您可以呼叫 [StartFaceSearch](https://docs.aws.amazon.com/rekognition/latest/APIReference/API_StartFaceSearch.html) 來搜尋影片中符合現有集合中之臉孔的人物。

如需建立和管理集合的詳細資訊，請參閱 [在集合中搜尋人臉](collections.md)。

**注意**  
集合存放臉部向量，這是臉部的數學表示法。集合不會存放臉部的影像。

**Example 1：建築物門禁驗證應用程式**  
首先需建立一個人臉集合，使用 `IndexFaces` 操作將掃描的名牌映像儲存於該集合，而此操作可擷取人臉並儲存為可搜尋的映像向量。接著，當員工進入大樓時，將拍攝員工人臉的映像並傳送至 `SearchFacesByImage` 操作。如果臉部比對的相似性分數達到設定的目標 (例如 99%)，即可驗證該員工身分。