Extending your AWS DeepLens Project

Introduction

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 order one 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.

 Services Used

Completing AWS DeepLens set up requires an AWS Account

Implementation

  • Enter the AWS DeepLens Console

    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.

    Open AWS DeepLens in the Console
  • Test Project Inference Output

    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.

    DeepLens Projects View

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

    Select your device from the list

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

    MyDevice Screen

    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.

    AWS IoT Console

    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.

    MQTT Client View - Subscribe to topic

    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.  

    MQTT Client View - Verify you see messages from the device
  • Capture and Act on Project Inference Output

    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.

    Create a rule

    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 the Topic filter field.

    Scroll down to the actions section and select Add action.

    Add action

    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.

    Select and configure action

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

    Create a new resource

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

    Name your queue

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

    Select the queue you just created

    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.

    Create a new role

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

    Name the new role

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

    Chose the newly created role

    j. Scroll down and select Add action.

    Add action

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

    Create rule
  • View the Messages in SQS

    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.

    Open SQS in the console

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

    Select the newly created queue name from the list

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

    Select view/delete messages

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

    Start polling for messages

    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. 

    View messages from the output of the inference project appearing in the queue

    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.

    Start a media player and watch your project's video stream using the command

Was this tutorial helpful?

Thank you
Please let us know what you liked.
Close
Sorry to disappoint you
Is something out-of-date, confusing or inaccurate? Please help us improve this tutorial by providing feedback.
Close

Congratulations!

You have created your first deep learning computer vision project!

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