{"id":1425,"date":"2022-01-03T23:13:00","date_gmt":"2022-01-03T23:13:00","guid":{"rendered":"https:\/\/salarydistribution.com\/machine-learning\/2022\/01\/03\/identity-verification-using-amazon-rekognition\/"},"modified":"2022-01-03T23:13:00","modified_gmt":"2022-01-03T23:13:00","slug":"identity-verification-using-amazon-rekognition","status":"publish","type":"post","link":"https:\/\/salarydistribution.com\/machine-learning\/2022\/01\/03\/identity-verification-using-amazon-rekognition\/","title":{"rendered":"Identity verification using Amazon Rekognition"},"content":{"rendered":"<div id=\"\">\n<p>In-person user identity verification is slow to scale, costly, and high friction for users. Machine learning (ML) powered facial recognition technology can enable online user identity verification. <a href=\"https:\/\/aws.amazon.com\/rekognition\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Rekognition<\/a> offers pre-trained <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/face-feature-differences.html\" target=\"_blank\" rel=\"noopener noreferrer\">facial recognition<\/a> capabilities that you can quickly add to your user onboarding and authentication workflows to verify opted-in users\u2019 identities online. No ML expertise is required. With Amazon Rekognition, you can onboard and authenticate users in seconds while detecting fraudulent or duplicate accounts. As a result, you can grow users faster, reduce fraud, and lower user verification costs.<\/p>\n<p>In this post, we describe a typical identity verification workflow and show how to build an identity verification solution using various Amazon Rekognition APIs. We provide a complete sample implementation in our <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub repository<\/a>.<\/p>\n<h2>User registration workflow<\/h2>\n<p>The following figure shows a sample workflow of a new user registration. Typical steps in this process are:<\/p>\n<ol>\n<li>User captures selfie image and the image of a government-issued identity document.<\/li>\n<li>Quality check of the selfie image and optional <a href=\"https:\/\/aws.amazon.com\/pt\/blogs\/industries\/improving-fraud-prevention-in-financial-institutions-by-building-a-liveness-detection-solution\/\" target=\"_blank\" rel=\"noopener noreferrer\">liveness detection<\/a> of the user face.<\/li>\n<li>Comparison of the selfie image with the identity document face image.<\/li>\n<li>Check of the selfie against a database of existing user faces.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image001.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-32031\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image001.png\" alt=\"\" width=\"2096\" height=\"1060\"><\/a><\/p>\n<p>You can customize the flow according to the business process. It often contains some or all of the steps presented in the preceding diagram. You can choose to run all the steps synchronously (wait for one step to complete before moving on to the next step). Alternately, you can run some of the steps highlighted in orange asynchronously (don\u2019t wait for that step to complete) to speed up the user registration process and improve the customer experience. If the steps aren\u2019t successful, you must roll back the user registration.<\/p>\n<p>In addition to new user registration, another common flow is an existing or returning user login. In this flow, a check of the user face (selfie) is performed against a previously registered face. Typical steps in this process include user face capture (selfie), check of the selfie image quality, and search and compare of the selfie against the faces database. The following diagram shows a possible flow.<\/p>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image003.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-32032\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image003.png\" alt=\"\" width=\"1724\" height=\"730\"><\/a><\/p>\n<p>You can customize the steps of the process according to your business needs, and choose to include or exclude the liveness detection.<\/p>\n<h2>Solution overview<\/h2>\n<p>The following reference architecture shows how you can use Amazon Rekognition, along with other AWS services, to implement identity verification.<\/p>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image005.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-32033\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image005.jpg\" alt=\"\" width=\"735\" height=\"801\"><\/a><\/p>\n<p>The architecture includes the following components:<\/p>\n<ol>\n<li>Applications invoke <a href=\"https:\/\/aws.amazon.com\/api-gateway\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon API Gateway<\/a> to route requests to the correct <a href=\"https:\/\/aws.amazon.com\/lambda\/\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Lambda<\/a> function depending on the user flow. There are four major actions in this solution: authenticate, register, register with ID card, and update.<\/li>\n<li>API Gateway uses a service integration to run the <a href=\"https:\/\/aws.amazon.com\/step-functions\/?step-functions.sort-by=item.additionalFields.postDateTime&amp;step-functions.sort-order=desc\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Step Functions<\/a> express state machine corresponding to the specific path called from API Gateway. Within each step, Lambda functions are responsible for triggering the correct set of calls to and from <a href=\"https:\/\/aws.amazon.com\/dynamodb\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon DynamoDB<\/a> and <a href=\"https:\/\/aws.amazon.com\/s3\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Simple Storage Service<\/a> (Amazon S3), along with the relevant Amazon Rekognition APIs.<\/li>\n<li>DynamoDB holds face IDs (<code>face-id<\/code>), S3 path URIs, and unique IDs (for example employee ID number) for each <code>face-id<\/code>. Amazon S3 stores all the face images.<\/li>\n<li>The final major component of the solution is Amazon Rekognition. Each flow (authenticate, register, register with ID card, and update) calls different Amazon Rekognition APIs depending on the task.<\/li>\n<\/ol>\n<p>Before we deploy the solution, it\u2019s important to know the following concepts and API descriptions:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/collections.html\" target=\"_blank\" rel=\"noopener noreferrer\">Collections<\/a> \u2013 Amazon Rekognition stores information about detected faces in server-side containers known as <em>collections<\/em>. You can use the facial information that\u2019s stored in a collection to search for known faces in images, stored videos, and streaming videos. You can use collections in a variety of scenarios. For example, you might create a face collection to store scanned badge images by using the <code><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_IndexFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">IndexFaces<\/a><\/code> operation. When an employee enters the building, an image of the employee\u2019s face is captured and sent to the <code><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_SearchFacesByImage.html\" target=\"_blank\" rel=\"noopener noreferrer\">SearchFacesByImage <\/a><\/code>operation. If the face match produces a sufficiently high similarity score (say 99%), you can authenticate the employee.<\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_DetectFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">DetectFaces API<\/a> \u2013 This API detects faces within an image provided as input and returns information about faces. In a user registration workflow, this operation may help you screen images before moving to the next step. For example, you can check if a photo contains a face, if the person identified is in the right orientation, and if they\u2019re not wearing any face blocker such as sunglasses or a cap.<\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_IndexFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">IndexFaces API<\/a> \u2013 This API detects faces in the input image and adds them to the specified collection. This operation is used to add a screened image to a collection for future queries.<\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_SearchFacesByImage.html\" target=\"_blank\" rel=\"noopener noreferrer\">SearchFacesByImage API<\/a> \u2013 For a given input image, the API first detects the largest face in the image, and then searches the specified collection for matching faces. The operation compares the features of the input face with face features in the specified collection.<\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_CompareFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">CompareFaces API<\/a> \u2013 This API compares a face in the source input image with each of the 100 largest faces detected in the target input image. If the source image contains multiple faces, the service detects the largest face and compares it with each face detected in the target image. For our use case, we expect both the source and target image to contain a single face.<\/li>\n<li><a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_DeleteFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">DeleteFaces API<\/a> \u2013 This API deletes faces from a collection. You specify a collection ID and an array of face IDs to remove.<\/li>\n<\/ul>\n<h2>Prerequisites<\/h2>\n<p>Before you get started, complete the following prerequisites:<\/p>\n<ol>\n<li><a href=\"https:\/\/aws.amazon.com\/premiumsupport\/knowledge-center\/create-and-activate-aws-account\/\" target=\"_blank\" rel=\"noopener noreferrer\">Create an AWS account<\/a>.<\/li>\n<li>Clone the sample repo on your local machine:\n<div class=\"hide-language\">\n<pre><code class=\"lang-bash\">git clone https:\/\/github.com\/aws-samples\/rekognition-identity-verification.git<\/code><\/pre>\n<\/p><\/div>\n<\/li>\n<\/ol>\n<p>We use the test client in this repository to test the various workflows.<\/p>\n<ol start=\"3\">\n<li>Install <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python 3.6+<\/a> on your local machine.<\/li>\n<\/ol>\n<h2>Deploy the solution<\/h2>\n<p>Choose the appropriate <a href=\"http:\/\/aws.amazon.com\/cloudformation\" target=\"_blank\" rel=\"noopener noreferrer\">AWS CloudFormation<\/a> stack to provision the solution into your AWS account in your preferred Region:<\/p>\n<p><a href=\"https:\/\/console.aws.amazon.com\/cloudformation\/home?region=us-east-1#\/stacks\/create\/template?stackName=Riv-Prod&amp;templateURL=https:\/\/aws-ml-blog.s3.amazonaws.com\/artifacts\/rekognition-identity-verification-solution\/Riv-Prod.template.json\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15948 size-full\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2020\/09\/16\/2-LaunchStack.jpg\" alt=\"\" width=\"107\" height=\"20\"><\/a> N. Virginia (<code>us-east-1<\/code>)<\/p>\n<p><a href=\"https:\/\/us-west-2.console.aws.amazon.com\/cloudformation\/home?region=us-west-2#\/stacks\/create\/template?stackName=Riv-Prod&amp;templateURL=https:\/\/aws-ml-blog.s3.amazonaws.com\/artifacts\/rekognition-identity-verification-solution\/Riv-Prod.template.json\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15948 size-full\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2020\/09\/16\/2-LaunchStack.jpg\" alt=\"\" width=\"107\" height=\"20\"><\/a> Oregon (<code>us-west-2<\/code>)<\/p>\n<p>As we discussed earlier, this solution uses API Gateway integrated with Step Functions and Amazon Rekognition APIs to run the identity verification workflows. To test the solution, follow the steps in the <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/tree\/main\/src\/test-client\" target=\"_blank\" rel=\"noopener noreferrer\">code repository<\/a> to use the provided test client.<\/p>\n<p>The following sections describe the various workflows implemented via Step Functions.<\/p>\n<h2>New user registration<\/h2>\n<p>The following image illustrates the Step Functions definition for new user registration. The steps are defined in the <code><a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/infra\/userportal\/states\/register_user.py\" target=\"_blank\" rel=\"noopener noreferrer\">register_user.py<\/a><\/code> file.<\/p>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image010-500.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-32042 size-full\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image010-500.jpg\" alt=\"\" width=\"500\" height=\"589\"><\/a><\/p>\n<p>Three functions are called in this workflow: <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/tree\/main\/src\/rekognition\/detect-faces\" target=\"_blank\" rel=\"noopener noreferrer\">detect-faces<\/a>, <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/tree\/main\/src\/rekognition\/search-faces\" target=\"_blank\" rel=\"noopener noreferrer\">search-faces<\/a>, and <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/tree\/main\/src\/rekognition\/index-faces\" target=\"_blank\" rel=\"noopener noreferrer\">index-faces<\/a>. The <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/src\/rekognition\/detect-faces\/handler.py\" target=\"_blank\" rel=\"noopener noreferrer\">detect-faces<\/a> function calls the Amazon Rekognition DetectFaces API to determine if a face is detected in an image and is usable. Some of the quality checks include determining that only the face is present in the image, ensuring the face isn\u2019t obscured by sunglasses or a hat, and confirming that the face isn\u2019t rotated by using the <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_Pose.html\" target=\"_blank\" rel=\"noopener noreferrer\">pose<\/a> dimension. If the image passes the quality check, the <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/src\/rekognition\/search-faces\/handler.py\" target=\"_blank\" rel=\"noopener noreferrer\">search-faces<\/a> function searches for an existing face match in the Amazon Rekognition collections by confirming the <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_SearchFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">FaceMatchThreshold<\/a> confidence score meets your threshold objective. For more information, refer to the section on using <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/collections.html\" target=\"_blank\" rel=\"noopener noreferrer\">similarity thresholds to match faces<\/a>. If the face image doesn\u2019t exist in the collections, the <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/src\/rekognition\/index-faces\/handler.py\" target=\"_blank\" rel=\"noopener noreferrer\">index-faces<\/a> function is called to index the face into the collection. The face image metadata is stored in the DynamoDB table and the face images are stored in an S3 bucket.<\/p>\n<p>To register a new user, run the <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/src\/test-client\/app.py\" target=\"_blank\" rel=\"noopener noreferrer\">app.py<\/a> script (<code>test-client<\/code>) by running the following code:<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-python\">python3 src\/test-client\/app.py register -z Riv-Prod -r <span>&lt;region&gt;<\/span> -u <span>&lt;username&gt;<\/span> -p <span>&lt;path to face image&gt;<\/span><\/code><\/pre>\n<\/p><\/div>\n<p>If the new user registration succeeds, the face image attribute information is added in DynamoDB.<\/p>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image012.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-32035\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image012.jpg\" alt=\"\" width=\"1954\" height=\"1060\"><\/a><\/p>\n<h2>New user registration with ID card<\/h2>\n<p>The steps to register a new user with an ID card are similar to the steps for registering a new user. The following image illustrates the steps, which are defined in the <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/infra\/userportal\/states\/register_idcard.py\" target=\"_blank\" rel=\"noopener noreferrer\"><code>register_idcard.py<\/code><\/a> file.<\/p>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image014-500.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-32043 size-full\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image014-500.jpg\" alt=\"\" width=\"500\" height=\"678\"><\/a><\/p>\n<p>The same three functions that we used to register a user (<code>detect-faces<\/code>, <code>search-faces<\/code>, and <code>index-faces<\/code>) are called in for this workflow. First, the customer captures an image of their ID and a live image of their face. The face image is checked to confirm it meets our defined quality standards using the <code>DetectFaces<\/code> API. If the image meets the quality standards, the live face image is compared to the face in the ID to determine if they\u2019re a match. If the images don\u2019t match, the user receives an error and the process ends. If the images match, we check if the face already exists in the Amazon Rekognition collections using the <code>SearchFacesByImage<\/code> API. The search results are compared to the user\u2019s current face image. If the user already exists, the user isn\u2019t registered. If the user doesn\u2019t exist in the collections, the relevant properties are extracted from the ID card. You can extract key-value pairs from identity documents using the newly launched <a href=\"https:\/\/docs.aws.amazon.com\/textract\/latest\/dg\/how-it-works-identity.html\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Textract<\/a> <code>AnalyzeID<\/code> API. The extracted properties from the ID card are merged and the user\u2019s face is indexed in the DynamoDB table. After the image is indexed, the new user ID registration process is complete.<\/p>\n<h2>Existing user authentication<\/h2>\n<p>The following image illustrates the workflow for authenticating an existing user. The steps are defined in the <code><a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/infra\/userportal\/states\/auth.py\" target=\"_blank\" rel=\"noopener noreferrer\">auth.py<\/a><\/code> file.<\/p>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image016-500.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-32044 size-full\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image016-500.jpg\" alt=\"\" width=\"500\" height=\"712\"><\/a><\/p>\n<p>This Step Function workflow calls three functions: <code>detect-faces<\/code>, <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/src\/rekognition\/compare-faces\/handler.py\" target=\"_blank\" rel=\"noopener noreferrer\"><code>compare-faces<\/code><\/a>, and <code>search-faces<\/code>. After the <code>detect-faces<\/code> function verifies that the captured face image is valid, the <code>compare-faces<\/code> function checks the DynamoDB table for a face image that matches an existing user. If a match is found in DynamoDB, the user authenticates successfully. If a match isn\u2019t found, the <code>search-faces<\/code> function is called to search for the face image in the collections. The user is verified and the authentication process completes if their face image exists in the collections. Otherwise, the user\u2019s access is denied.<\/p>\n<p>To test authenticating an existing user, run the <code><a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/src\/test-client\/app.py\" target=\"_blank\" rel=\"noopener noreferrer\">app.py<\/a><\/code> script (<code>test-client<\/code>) by running the following code::<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-python\">python3 src\/test-client\/app.py auth -z Riv-Prod -r <span>&lt;region&gt;<\/span> -u <span>&lt;username&gt;<\/span> -p <span>&lt;path to face image&gt;<\/span><\/code><\/pre>\n<\/p><\/div>\n<h2>Existing user login with a request for photo update<\/h2>\n<p>The following image illustrates the workflow to update an existing user\u2019s photo. The steps are defined in the <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/infra\/userportal\/states\/update.py\" target=\"_blank\" rel=\"noopener noreferrer\"><code>update.py<\/code><\/a> file.<\/p>\n<p><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image018-500.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-32045 size-full\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/ML-7111-image018-500.jpg\" alt=\"\" width=\"500\" height=\"722\"><\/a><\/p>\n<p>This workflow calls four functions: <code>detect-faces<\/code>, <code>compare-faces<\/code>, <code>search-faces<\/code>, and <code>index-faces<\/code>. The steps are similar to the steps in the existing user authentication workflow. After the user captures their face image and the image quality is checked, we check for a matching face image in DynamoDB using the <code>compare-faces<\/code> function. If a match for the user is found, their user profile is updated, their new face image is indexed by calling the <code>index-faces<\/code> function, and the update process completes. Alternatively, if a match isn\u2019t found, the search-faces function is called to search for the face image in the Amazon Rekognition collections. If the face image is found in the collection, the user\u2019s profile is updated and their new face image is indexed. The user\u2019s access is denied if their image isn\u2019t found in the collections.<\/p>\n<p>To update an existing user\u2019s photo, run the <a href=\"https:\/\/github.com\/aws-samples\/rekognition-identity-verification\/blob\/main\/src\/test-client\/app.py\" target=\"_blank\" rel=\"noopener noreferrer\">app.py<\/a> script (<code>test-client<\/code>) by running the following code:<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-python\">python3 src\/test-client\/app.py update -z Riv-Prod -r <span>&lt;region&gt;<\/span> -u <span>&lt;username&gt;<\/span> -p <span>&lt;path to updated face image&gt;<\/span><\/code><\/pre>\n<\/p><\/div>\n<h2>Clean up<\/h2>\n<p>To prevent accruing additional charges in your AWS account, delete the resources you provisioned by navigating to the AWS CloudFormation console and deleting the <code>Riv-Prod<\/code> stack.<\/p>\n<p>Deleting the stack doesn\u2019t delete the S3 bucket you created. This bucket stores all the face images. If you choose to delete the S3 bucket, navigate to the Amazon S3 console, empty the bucket, and then confirm you want to permanently delete it.<\/p>\n<h2>Conclusion<\/h2>\n<p>Amazon Rekognition makes it easy to add image analysis to your identity verification applications using proven, highly scalable, deep learning technology that requires no ML expertise to use. Amazon Rekognition provides <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/face-feature-differences.html\" target=\"_blank\" rel=\"noopener noreferrer\">face detection and comparison<\/a> capabilities. With a combination of the <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_DetectFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">DetectFaces<\/a>, <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_CompareFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">CompareFaces<\/a>, <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_IndexFaces.html\" target=\"_blank\" rel=\"noopener noreferrer\">IndexFaces<\/a>, and <a href=\"https:\/\/docs.aws.amazon.com\/rekognition\/latest\/dg\/API_SearchFacesByImage.html\" target=\"_blank\" rel=\"noopener noreferrer\">SearchFacesByImage<\/a> APIs, you can implement the common flows around new user registration and existing user logins.<\/p>\n<p>Amazon Rekognition collections provide a method to store information about detected faces in server-side containers. You can then use the facial information stored in a collection to search for known faces in images. When using collections, you don\u2019t need to store original photos after you index faces in the collection. Amazon Rekognition collections don\u2019t persist actual images. Instead, the underlying detection algorithm detects the faces in the input image, extracts facial features into a feature vector for each face, and stores it in the collection.<\/p>\n<p>To start your journey towards identity verification, visit <a href=\"https:\/\/aws.amazon.com\/rekognition\/identity-verification\/\" target=\"_blank\" rel=\"noopener noreferrer\">Identity Verification using Amazon Rekognition<\/a>.<\/p>\n<hr>\n<h3>About the Authors<\/h3>\n<p><strong><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/Nate-Bachmeier.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-32039 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/Nate-Bachmeier.png\" alt=\"\" width=\"100\" height=\"137\"><\/a>Nate Bachmeier<\/strong> is an AWS Senior Solutions Architect that nomadically explores New York, one cloud integration at a time. He specializes in migrating and modernizing applications. Besides this, Nate is a full-time student and has two kids.<\/p>\n<p><strong><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/Anthony-Pasquariello.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-32029 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/Anthony-Pasquariello.png\" alt=\"\" width=\"100\" height=\"124\"><\/a>Anthony Pasquariello<\/strong> is an Enterprise Solutions Architect based in New York City. He provides technical consultation to customers during their cloud journey, especially around security best practices. He has an MS and BS in electrical and computer engineering from Boston University. In his free time, he enjoys ramen, writing non-fiction, and philosophy.<\/p>\n<p><strong><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-32067 size-full alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2022\/01\/03\/Lauren-Mullennex.jpg\" alt=\"\" width=\"99\" height=\"127\">Lauren Mullennex<\/strong> is a Solutions Architect based in Denver, CO. She works with customers to help them architect solutions on AWS. In her spare time, she enjoys hiking and cooking Hawaiian cuisine.<\/p>\n<p><strong><a href=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/Amit-Gupta.png\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-32028 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2021\/12\/30\/Amit-Gupta.png\" alt=\"\" width=\"100\" height=\"135\"><\/a>Amit Gupta<\/strong> is a Senior AI Services Solutions Architect at AWS. He is passionate about enabling customers with well-architected machine learning solutions at scale.<\/p>\n<p>       <!-- '\"` -->\n      <\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/aws.amazon.com\/blogs\/machine-learning\/identity-verification-using-amazon-rekognition\/<\/p>\n","protected":false},"author":0,"featured_media":1426,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts\/1425"}],"collection":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/comments?post=1425"}],"version-history":[{"count":0,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/posts\/1425\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/media\/1426"}],"wp:attachment":[{"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/media?parent=1425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/categories?post=1425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salarydistribution.com\/machine-learning\/wp-json\/wp\/v2\/tags?post=1425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}