将面部相似性与 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 名称和文件名。