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.
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.
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.
b. Choose Devices view, and select your device from the list.
c. Scroll down the MyDevice screen and select and copy the MQTT Topic Name at the bottom.
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.
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.
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.
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.
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.
d. You can choose an existing SQS queue or create a new one. Select Create a new resource.
e. Name the new queue (e.g. ObjectDetectionOutput), scroll down and select Quick-Create Queue.
f. Refresh the list of SQS queues and select the queue that 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.
h. Name to the new role (e.g. ObjectDetectionQueueRole), and select Create a new role.
i. Refresh the list of IAM roles and choose the newly created role.
j. Scroll down and select Add action.
k. Now you're ready to complete the rule creation. Scroll down and select 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.
b. Select the newly created queue name from the list.
c. Go to the Queue Actions dropdown list and select View/Delete Messages.
d. A window will popup, select 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.
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.