This repository contains the {{ cookiecutter.project_name }} AWS Panorama application. AWS Panorama is a hardware and software platform that enables running computer vision (CV) applications analyzing video streams from on-premises internet protocol (IP) cameras.
This application can be deployed to Panorama-enabled devices, registered to an AWS account. Install the aws-cli and panorama-cli and configure the aws-cli to the credentials of the account where the Panorama appliance is registered. To compile the application container you will also need docker.
For your convenience, a Makefile
is provided. Invoke in order
make init-repo
to initialize a new git repository for your projectmake import
to prepare the project for building for building to your AWS accountmake build
to build the projectmake package
to upload the compiled packages to your AWS account for deployment on the Panorama.
After successfully executing make package
, you can head to AWS Panorama web console of your account, and deploy the application to the appliance using the application manifest file that was prepared by the last step.
This repo comes with a Makefile based build system. In the following chapters you can find information about the features of the build system. You can get help by simply invoking make
from the project folder.
It is highly recommended that you use a version control system to record the progress of your application development. You can launch the make init-repo
command to initialize a git repository for your project. This command also creates the first commit in the repo. It is highly recommended that you first launch this command in the project directory of the newly created Panorama application.
The make init-repo
command also registers a pre-commit github hook that will remind you to anonymize the AWS account id in your repository before committing the code to git. This way you can avoid leaking your account id to a potentially public repository.
A Panorama project has the somewhat questionable characteristic that it saves the current AWS account identifier in the folder and file names, as well as in the deployable package names. Before building and deploying the project, you should update the file names to your AWS account id. This can be done with make import
: the file and package names are updated with the account id currently configured in your aws-cli. This also updates the package names in the graph.json
manifest file. Later on, you can package and deploy the application with this graph.json
only on the same AWS account.
You can remove all references from the project to your AWS account using make anonymize
. This will replace the AWS account id with the dummy 123456789012
account id. Pushing the project with this dummy account id to public repositories will not leak your private account id.
The build system leverages the panorama-cli
and docker
to build the application container and the deep learning model. Invoking make build
will build both the application and the deep learning model package.
Use make package
to upload the compiled packages to your AWS account. When the packages are successfully uploaded, you can deploy your application to a registered Panorama appliance using the manifest file generated by the build system (its location is printed by the package command). Head to the AWS Panorama Console and deploy a new application with the manifest json.
If your development environment runs on an aarch64 (ARM) CPU, you can launch the application in the AWS Panorama Test Utility. The AWS Panorama Test Utility launches your Panorama application locally on the development machine. It takes care of compiling the deep learning model for your workstations (GPUs are not supported), but does not take care about application dependencies defined in the application Dockerfile
. You should create a virtual environment with your favorite virtual environment manager (conda, venv, etc.), create a new environment for the test utility, and install the dependencies from dev-requirements.txt
and the application's requirements.txt
.
You do not need to build the project to use the test utility: it will pick up the source code directly from the project folder.
Invoking make test_utility VIDEO_FILE=input.mp4
clones the Test Utility to your workstation, compiles the deep learning model for the test utility if required, and launches the test utility with the specified video as input. It saves the processed frames to the test_output
directory. You can also set VIDEO_START
, VIDEO_STEP
and VIDEO_STOP
variables in the command line to skip frames from the input video.
If you have ffmpeg installed, you can concatenate the frames to a continuous video invoking make test-video VIDEO_FPS=20
(modify the frame rate if needed).
The source code of the application can be found in the {{cookiecutter.project_slug}}/packages/123456789012-{{cookiecutter.code_package_name}}-{{cookiecutter.code_package_version}}/src
folder. Modify the source code and rebuild the application or start the Test Utility.
The build system generates a dummy deep learning model that is already integrated to the rest of the project. The dummy model simply calculates the RGB-wise mean of the input video frame. Nevertheless the simple functionality, this model can be compiled to the Panorama appliance GPU or the test utility, so you can test the whole model development pipeline. Later on, you can replace the model at models/{{ cookiecutter.model_package_name }}.tar.gz
to a real model.