This step-by-step tutorial will help guide you through extending a model with AWS DeepLens. AWS DeepLens is a fully programmable video camera that comes with tutorials, code, and pre-trained models designed to expand deep learning skills.

In this tutorial, you will capture the events from your AWS DeepLens model and put them in a queue ready for further processing. There are many use cases to extend the output AWS DeepLens models utilizing AWS Lambda functions, such as sending alerts, opening doors, populating analytical dashboards, to name just a few (see step 3.c. in this tutorial).

You will need an AWS DeepLens device in order to complete this tutorial. You can pre-order now on amazon.com.

If this is your first time using your AWS DeepLens check out the How to Configure AWS DeepLens and the Creating and Deploying an AWS DeepLens Project tutorials to help you get started.

Completing AWS DeepLens set up requires an AWS account

Create a Free Account

Open the AWS Management Console in a new browser window, so you can keep this step-by-step guide open.  When the screen loads, enter your user name and password to get started. Then type DeepLens in the search bar and select AWS DeepLens to open the console.

ss1

(click to zoom)

ss1

In this step, you will build upon the new project created in the tutorial Creating and Deploying an AWS DeepLens Project and view the output.


a. When you open the AWS DeepLens console you may have different views based on your recent actions. Select the Hamburger Menu symbol on the top left to see the list of views.

 

 

T3 S2

(click to zoom)

T3 S2

b. Choose Devices view, and select your device from the list.

T3 S3

(click to zoom)

T3 S3

c. Scroll down the MyDevice screen and select and copy the MQTT Topic Name at the bottom.

T3 S5

(click to zoom)

T3 S5

d. In the next few steps we will use the AWS IoT console. Follow this link or select the AWS icon on the top left and search IoT in the list of AWS services.

T3 S6

(click to zoom)

T3 S6

e. In the MQTT client, select the Test section from the list on the left, and paste the MQTT Topic Name that you copied in step 2-c of this tutorial to the Subscription topic field and select Subscribe to topic.

T3 S7

(click to zoom)

T3 S7

f. Verify that you see some messages from the device.

Note: You can also verify that your model is running by opening the output stream as described in the Creating and Deploying an AWS DeepLens Project tutorial.  

T3 S8

(click to zoom)

T3 S8

In this step, you will use the AWS IoT console, create a rule to send messages to an SQS queue ready for polling.


a. Start by choosing the Act section in the left navigation on the AWS IoT Console and select Create a rule.

T3 S9

(click to zoom)

T3 S9

b. Input a name for the new rule (e.g. ObjectDetectionRule), and in the Message source section define the Attribute to be “*” (All) and paste the Topic name from step 2-c of this tutorial into theTopic filter field.

Scroll down to the actions section and select Add action.

T3 S10

(click to zoom)

T3 S10

c. Now its time to add an action. There are many options for the events that are captured by the IoT Rule Engine, some for processing and some for storage and analytics. Select the option to Send a message to an SQS queue, scroll down and select Configure action.

T3 S11

(click to zoom)

T3 S11

d. You can choose an existing SQS queue or create a new one. Select Create a new resource.

T3 S12

(click to zoom)

T3 S12

e. Name the new queue (e.g. ObjectDetectionOutput), scroll down and select Quick-Create Queue.

T3 S13

(click to zoom)

T3 S13

f. Refresh the list of SQS queues and select the queue that you just created.

T3 S14

(click to zoom)

T3 S14

g. To secure who can write and read from the new queue you need to create an IAM role. Select Create a new role.

Unfamiliar with IAM roles? Learn more here.

T3 S15

(click to zoom)

T3 S15

h. Name to the new role (e.g. ObjectDetectionQueueRole), and select Create a new role.

T3 S16

(click to zoom)

T3 S16

i. Refresh the list of IAM roles and choose the newly created role.

T3 S17

(click to zoom)

T3 S17

j. Scroll down and select Add action.

T3 S18

(click to zoom)

T3 S18

k. Now you're ready to complete the rule creation. Scroll down and select Create rule.


T3 S19

(click to zoom)

T3 S19

In this final step, you will learn how to view the messages in the SQS console.


a. Follow this link or select the AWS icon on the top left and search for SQS from the AWS services list.
 

T3 S20

(click to zoom)

T3 S20

b.  Select the newly create queue name from the list.
 

T3 S21

(click to zoom)

T3 S21

c. Go to the Queue Actions dropdown list and select View/Delete Messages.

T3 S22

(click to zoom)

T3 S22

d. A window will popup, select Start Polling for Messages.

T3 S23

(click to zoom)

T3 S23

e. If your model is running, and your device is connected, you should be able to see a few messages from the output of the inference project appearing in the queue. 

T3 S24

(click to zoom)

T3 S24

f. If you don’t see any messages in the queue, you can start a media player and watch your project's video stream using the command (Creating and Deploying an AWS DeepLens Project tutoria): mplayer -demuxer lavf -lavfdopts format=mjpeg:probesize=32 /tmp/results.mjpeg.

T3 S25

(click to zoom)

T3 S25

 You have created your first deep learning computer vision project!

You can now play around the other project templates, try extending your project functionality with AWS Lambda or train a deep learning model using Amazon SageMaker.

Now that you have deployed a model to AWS DeepLens, pick one of the following options to further expand your knowledge.

Dive deeper

Get even more info on how to use AWS DeepLens. Check out the full Getting Started Guide »

Learn more

Learn how to customize and display project output from AWS DeepLens on an HTML page. Read the blog here »

Build a project

Get an overview of training a model with Amazon SageMaker and extending it with AWS Lambda. Read the blog here»

Yes
No