By: Viraj Deshwal, Machine Learning Engineer, TensorIoT and Nicholas Burden, Technical Evangelist, TensorIoT
Welcome to the second in our series about AWS Panorama, the new tool providing cloud integration to bring Computer Vision to the edge with a fully managed AWS Edge inference device for real-time inference.
Amazon Web Services (AWS) released AWS Panorama during re:Invent 2020, and TensorIoT is actively incorporating this exciting new tool into our products and solutions, such as SafetyVisor, our professional computer vision product that detects usage of masks and other protective gear.
In this blog, we’ll explore connecting an iPhone or any other camera using RTSP (Real-Time Streaming Protocol) stream to Panorama appliance and creating an application to detect people, cars, trains and other environmental objects. We will be detecting all the classes available in the VOC Dataset (http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html).
Step 1: Download the ResNet-50 (https://en.wikipedia.org/wiki/Residual_neural_network) model trained on VOC dataset and upload in the S3. The S3 should have the following name format: “Aws-panorama-xyz”
Step 2: Go to Lambda (https://us-west-2.console.aws.amazon.com/lambda/home?region=us-west-2#/functions) in the AWS console and click on “create function.”
Step 3: Select Author from Scratch.
Give function name “aws-panorama-lambda-xyz”
Choose Runtime: Python 3.7
Once the lambda is created, scroll down and clean your lambda_function.py window and copy the following code in your lamda’s “Function code” window.
Important Notes — Inline 21st, Make sure the name of your model is the same
Here -> (“model”, “people_counter”, “Model for people counting”, “Name of your model”),
Step 4: In the “Runtime setting” of the lambda. Click Edit and change the lambda handler to => lambda_function.main
Step 5: Click on Actions => Publish New version.
We will be using the version number of the lambda during the deployment.
Step 6: Go to Panorama, Click on My application => Create Application.
Step 7: Name the application. Example — “aws-panorama-XYZ”
Step 8: Choose Model — pay close attention to the details in this step -
- Choose the model name we inserted in our lambda in line 21. For example, I inserted the name in my lambda “ aws-panorama-person-detection”
- Here In “Choose A model” -
a. Paste the AWS S3 model object path
b. Enter the model name
c. Model framework — MxNet
d. Click on add input — Input 1 (1. input name — “data” 2. Shape — 1, 3, 512, 512)
e. Click add
Step 9: Choose Lambda -
Select the name of your lambda function, click on [+] button and select the latest version of your deployment.
Step 10: Proceed to Deployment
- Choose Appliance — Name of your Panorama Appliance(Hardware)
- Choose Camera Setting — Select the camera streams connected to your appliance.
- Click Deploy.
Step 10: Go to the Cloudwatch console.
- Click on Log Groups.
- Search panorama — you will see your logs with name starting with
3. Inside your logs open the first one which will also include your device name.
Now you’re all set to use detection with AWS Panorama. If you have any questions or requests for further content you can email us at email@example.com.
About us —
As a launch partner for AWS Panorama, TensorIoT has invested in training, updating models, and integrating Panorama into our Computer Vision Solutions. AWS Panorama brings Cloud-to-Edge to a managed service for creating, deploying, and managing applications at the Edge.