將面部相似性與 AWS Rekognition 進行比較

$BucketName = 'trevorrekognition'

### Create a new AWS S3 Bucket
New-S3Bucket -BucketName $BucketName

### Upload two different photos of myself to AWS S3 Bucket
Write-S3Object -BucketName $BucketName -File myphoto1.jpg
Write-S3Object -BucketName $BucketName -File myphoto2.jpg

### Perform a facial comparison between the two photos with AWS Rekognition
$Comparison = @{
    SourceImageBucket = $BucketName
    TargetImageBucket = $BucketName
    SourceImageName = 'myphoto1.jpg'
    TargetImageName = 'myphoto2.jpg'
    Region = 'us-east-1'
}
$Result = Compare-REKFace @Comparison
$Result.FaceMatches

上面提供的示例指令碼應該為你提供類似於以下內容的結果:

Face                                  Similarity
----                                  ----------
Amazon.Rekognition.Model.ComparedFace 90

AWS Rekognition 服務使你可以在兩張照片之間執行面部比較。使用此服務非常簡單。只需將要比較的兩個影象檔案上傳到 AWS S3 Bucket 即可。然後,呼叫 Compare-REKFace 命令,類似於上面提供的示例。當然,你需要提供自己的,全域性唯一的 S3 Bucket 名稱和檔名。