Deploying the AWS Panorama sample application - AWS Panorama

Deploying the AWS Panorama sample application

After you've set up your AWS Panorama Appliance Developer Kit and upgraded its software, deploy a sample application. In the following sections, you define the application code, import a machine learning model, and deploy an application with the AWS Panorama console.

The sample application uses a machine learning model to detect people in frames of video from a network camera. It uses the AWS Panorama Application SDK to load a model, get images, and run the model. The application then overlays the results on top of the original video and outputs it to a connected display.

In a retail setting, analyzing foot traffic patterns enables you to predict traffic levels. By combining the analysis with other data, you can plan for increased staffing needs around holidays and other events, measure the effectiveness of advertisements and sales promotions, or optimize display placement and inventory management.

Create a bucket for storage

Create an Amazon S3 bucket for the sample model file.

To create a bucket

  1. Open the Amazon S3 console.

  2. Choose Create bucket.

  3. Follow the instructions to create a bucket with the following settings:

    • Bucket name – The name must contain the phrase aws-panorama. For example, aws-panorama-artifacts-123456789012.

    • Region – The AWS Region where you use AWS Panorama.

  4. Upload the model archive to the bucket.

When the upload operation is complete, view the details of the model file and note the S3 URL value for later use.

Create a Lambda function

Use the Lambda console to create the Lambda function that the application uses to run inference against the model. The code is stored and versioned in Lambda, but it is not invoked in Lambda. You deploy the code to the AWS Panorama Appliance Developer Kit and it runs continually while the developer kit is on.

When you create a Lambda function, you give it a role that enables it to upload logs and access services with the AWS SDK. This role is typically used when the function runs in Lambda, but when you run the application on the developer kit, the developer kit's permissions are used. You can let the Lambda console create a role or, if you don't have permission to create roles, use a role that an administrator creates for you.

To create a Lambda function

  1. Sign in to the AWS Management Console and open the AWS Lambda console at

  2. Choose Create function.

  3. For Basic information, configure the following settings:

    • Function nameaws-panorama-sample-function.

    • RuntimePython 3.7.

    • Permissions – To create a new role, use the default setting. If you have a role that you want to use, choose Use an existing role.

  4. Choose Create function.

Lambda creates the function and opens the function details page. Modify the function code and configure the function's runtime settings. Then, to create an immutable snapshot of the function's code and configuration, publish a version.

To update the function's code and configuration

  1. For Code source, choose Upload from and then choose .zip file.

  2. Upload the sample code deployment package and then choose Save.

  3. When the operation is complete, in the Runtime settings section, choose Edit.

  4. Configure the following settings:

    • Handlerlambda_function.main. In the sample application, the file exports a method named main that serves as the handler.

  5. Choose Save.

  6. Above the code editor, choose the Configuration tab.

  7. In the General configuration section, choose Edit.

  8. Configure the following settings:

    • Timeout2 minutes.

    • Memory2048 MB.

  9. Choose Save.

  10. Choose Actions.

  11. Choose Publish new version, and then choose Publish.

When you configure an application, you choose a function version. Using a version ensures that the application continues to work if you make changes to the function's code. To update the application's code, you publish a new version in Lambda and configure the application to use it.

Create the application

In this example, the application uses a Lambda function named aws-panorama-sample-function to run inference against the aws-panorama-sample-model model on video streams from a camera. The function displays the result on an HDMI display connected to the developer kit.

To import the sample model and create an application, use the AWS Panorama console.

To create an application

  1. Open the AWS Panorama console Getting started page.

  2. Choose Create application.

  3. Complete the workflow with the following settings:

    • Nameaws-panorama-sample

    • Model source – External model

    • Model artifact path – The Amazon S3 URI of the model archive. For example: s3://aws-panorama-artifacts-123456789012/ssd_512_resnet50_v1_voc.tar.gz

    • Model nameaws-panorama-sample-model

      This value is used by the application code. Enter it exactly as shown.

    • Model frameworkMXNet

    • Input namedata

    • Shape1,3,512,512

    • Lambda functions – aws-panorama-sample-function version 1

The value for Shape, 1,3,512,512, indicates the number of images that the model takes as input (1), the number of channels in each image (3--red, green, and blue), and the dimensions of the image (512 x 512). The values and order of the array varies among models.

Deploy the application

Use the AWS Panorama console to deploy the application to your AWS Panorama Appliance Developer Kit. AWS Panorama uses AWS IoT Greengrass to deploy the application code and model to the developer kit.

To deploy the application

  1. Open the AWS Panorama console Applications page.

  2. To open the application page, choose aws-panorama-sample.

  3. Choose Deploy.

  4. Follow the instructions to deploy the application.

When the deployment is complete, the application starts processing the video stream and displays the output on the connected monitor.

If the application doesn't start running, check the application and device logs in Amazon CloudWatch Logs.

Clean up

If you are done working with the sample application, you can use the AWS Panorama console to remove it from the developer kit and delete it.

To remove the application from the developer kit

  1. Open the AWS Panorama console Appliances page.

  2. Choose the developer kit.

  3. Check the box next to the application's name.

  4. Choose Delete application.

To delete the application from AWS Panorama

  1. Open the AWS Panorama console Applications page.

  2. Choose an application.

  3. Choose Delete.

The Lambda function and Amazon S3 bucket that you created are not deleted automatically. You can delete them in the Lambda console and Amazon S3 console, respectively.

Next steps

If you encountered errors while deploying or running the sample application, see Troubleshooting.

To learn more about the sample application's features and implementation, continue to the next topic.

To learn about the AWS Panorama Appliance Developer Kit, continue to Using the AWS Panorama Appliance Developer Kit.