You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: ImageProcessing/README.md
+20-17Lines changed: 20 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,8 @@ When users upload the photo of themselves, a few steps of verification and proce
17
17
1. Index the user's face into the collection so it can be used for matching in the future.
18
18
1. Store the photo metadata with the user's profile.
19
19
20
-
In the serverless world, each of steps above can be easily implemented with a AWS Lambda function. But how can we manage the flow of invoking one Lambda function after the previous step has finished and keep track of what happened with each image? What if one of the Lambda function times out and needs to be retried? Some of the Lambda functions can be run in parallel to reduce end-to-end processing latency, how can we coordinate running Lambda functions in parallel and wait for them to finish? AWS Step Functions makes it very easy to solve these problems and provides an audit trail and visualization to track what happened with each flow.
20
+
In the serverless world, each of steps above can be easily implemented with a AWS Lambda function. But how can we manage the flow of invoking one Lambda function after the previous step has finished and keep track of what happened with each image? What if one of the Lambda function times out and needs to be retried? Some of the Lambda functions can be run in parallel to reduce end-to-end processing latency, how can we coordinate running Lambda functions in parallel and wait for them to finish? AWS Step Functions makes it very easy to solve these problems and provides an audit trail and visualization to track what happened with each flow.
21
+
21
22
## Architecture Overview
22
23
The architecture for this module is composed of several AWS Lambda functions that leverage the facial detection capabilities of **Amazon Rekognition**, resize the uploaded image stored in **Amazon S3**, and save the image metadata with the user profile using **Amazon DynamoDB**. The orchestration of these Lambda functions is managed by an **AWS Step Functions** state machine.
23
24
@@ -27,7 +28,8 @@ Below is the flow diagram of the workflow we will build as visualized by **AWS
In this module, we will manually kick-off processing workflows from the AWS Step Functions management console. In a real world application, you can configure an Amazon API Gateway that your application invokes to trigger the Step Functions state machine, or have it triggered by an Amazon S3 upload event through Amazon CloudWatch Events or S3 event notifications.
31
+
In this module, we will manually kick-off processing workflows from the AWS Step Functions management console. In a real world application, you can configure an Amazon API Gateway that your application invokes to trigger the Step Functions state machine, or have it triggered by an Amazon S3 upload event through Amazon CloudWatch Events or S3 event notifications.
32
+
31
33
## Implementation Instructions
32
34
33
35
Each of the following sections provide an implementation overview and detailed, step-by-step instructions. The overview should provide enough context for you to complete the implementation if you're already familiar with the AWS Management Console or you want to explore the services yourself without following a walkthrough.
@@ -69,8 +71,10 @@ Using the AWS Command Line Interface, create a collection in the Amazon Rekognit
69
71
70
72
### 2. Deploy Amazon S3, AWS Lambda and Amazon DynamoDB resources using AWS CloudFormation
71
73
72
-
The following AWS CloudFormation template will create these resources:
73
-
* Two Amazon S3 buckets: * **RiderPhotoS3Bucket** stores the photos uploaded by the riders
74
+
The following AWS CloudFormation template will create these resources:
75
+
76
+
* Two Amazon S3 buckets:
77
+
* **RiderPhotoS3Bucket** stores the photos uploaded by the riders
74
78
* A few test images will be copied into the **RiderPhotoS3Bucket** bucket
75
79
* **ThumbnailS3Bucket** stores the resized thumbnails of the rider photos
76
80
* One Amazon DynamoDB table **RiderPhotoDDBTable** that stores the metadata of the rider's photo with rider's profile
@@ -118,7 +122,7 @@ Asia Pacific (Sydney) | <span style="font-family:'Courier';">ap-southeast-2</spa
118
122
119
123
120
124
121
-
### 3. Create an initial AWS Step Functions state machine
125
+
### 3. Create an initial AWS Step Functions state machine
122
126
123
127
After the riders upload their photo, the first thing we need do in our processing pipeline is to run a face detection algorithm on it to verify that it has a recognizable face in the photo (zero or multiple faces in the photo doesn't help unicorns recognize the rider) and the face is not wearing sunglasses (makes it harder to identify the rider). If these validations fail, notify the user and end the workflow.
124
128
@@ -191,34 +195,33 @@ Now you can create an AWS Step Functions state machine with the initial face det
191
195
192
196
1. Type `RiderPhotoProcessing` for the state machine name.
193
197
194
-
1. For **IAM role for your state machine executions**, pick **I will use an existing role**, and select the IAM role created by the CloudFormation in the previous step.
195
-
> The name of the IAM role should have the prefix `wildrydes-step-modules-resources` (the name of the CloudFormation stack) To verify the IAM role's full name, you can open a new tab for the CloudFormation console and check the **Output** section of the stack you just created, and look for `StateMachineRole`.
196
-
197
-

198
-
198
+
1. Paste in the JSON from your `rider-photo-state-machine.json` file into the **Code** editor portion.
199
199
200
-
1. Paste in the JSON from your `rider-photo-state-machine.json` file into the **Code** editor portion.
201
-
202
-
1. You can click on the ↺ sign next to **Preview** to visualize the workflow:
200
+
1. You can click on the ↺ sign in the preview panel to visualize the workflow:
203
201
204
202

205
203
204
+
1. Click **Next**.
205
+
206
+
1. For **IAM role for executions**, pick **Choose an existing role**, and select the IAM role created by the CloudFormation in the previous step.
207
+
> The name of the IAM role should have the prefix `wildrydes-step-modules-resources` (the name of the CloudFormation stack) To verify the IAM role's full name, you can open a new tab for the CloudFormation console and check the **Output** section of the stack you just created, and look for `StateMachineRole`.
208
+
209
+

206
210
207
211
1. Click **Create State Machine** to create the state machine.
208
212
209
-
1. Click the **New execution** button to start a new execution.
213
+
1. Click the **Start execution** button to start a new execution.
210
214
211
215
1. Here you specify the input data passed into the AWS Step Functions state machine to process.
212
216
213
217
Each execution of a Step Functions state machine has an unique ID. You can either specify one when starting the execution, or have the service generate one for you. In the text field that says "enter your execution id here", you can specify an execution ID, or leave it blank.
214
218
215
219
For the input data, type in the follow JSON. Make sure to substitute the `s3Bucket` field with your own values.
216
220
217
-
For `s3Bucket` field, look in the **Outputs** section of the `wildrydes-step-module-resources` stack for `RiderPhotoS3Bucket`.
221
+
For `s3Bucket` field, look in the **Outputs** section of the `wildrydes-step-module-resources` stack for `RiderPhotoS3Bucket`.
218
222
219
-
The `userId` field is needed because in later processing steps, the userId is used to record which user the profile picture is associated with.
223
+
The `userId` field is needed because in later processing steps, the userId is used to record which user the profile picture is associated with.
0 commit comments