{ "cells": [ { "cell_type": "markdown", "id": "4e136e6b", "metadata": {}, "source": [ "# TensorRT YoloV5s Sample Application\n" ] }, { "cell_type": "markdown", "id": "6c1fb2fe", "metadata": {}, "source": [ "--- \n", "\n", "1. [Prerequisites](#Prerequisites)\n", "1. [Set up](#Set-up)\n", "1. [Import model](#Import-model)\n", "1. [Write and test app code](#Write-and-test-app-code-in-notebook)\n", "1. [Package app](#Package-app)\n", "1. [Deploy app to device](#Deploy-app-to-device)" ] }, { "cell_type": "markdown", "id": "4a238dd9", "metadata": { "tags": [] }, "source": [ "# Prerequisites (DO NOT SKIP)" ] }, { "cell_type": "markdown", "id": "fd0bc9cd", "metadata": {}, "source": [ "1. **Please read the [Workshop document](https://catalog.workshops.aws/panorama-immersion-day/en-US/40-lab3-object-detection-with-yolov5s-and-tensorrt/41-lab3) before you start using this notebook**" ] }, { "cell_type": "markdown", "id": "457bb552", "metadata": { "tags": [] }, "source": [ "# Set up" ] }, { "cell_type": "markdown", "id": "8bd422e1", "metadata": {}, "source": [ "Import libraries for use with this notebook environment, you do not need these libraries when you write your application code." ] }, { "cell_type": "code", "execution_count": null, "id": "df9b2d8c", "metadata": {}, "outputs": [], "source": [ "import sys\n", "import os\n", "import time\n", "import json\n", "import boto3\n", "import sagemaker\n", "\n", "sys.path.insert( 0, os.path.abspath( \"../common/test_utility\" ) )\n", "import panorama_test_utility" ] }, { "cell_type": "markdown", "id": "c8225c0b", "metadata": { "tags": [] }, "source": [ "## Notebook parameters\n", "Global constants that help the notebook create Panorama resources on your behalf." ] }, { "cell_type": "code", "execution_count": null, "id": "d6d19df8", "metadata": { "tags": [] }, "outputs": [], "source": [ "# application name\n", "app_name = 'lab3'\n", "\n", "## package names and node names\n", "code_package_name = 'lab3'\n", "camera_node_name = 'abstract_rtsp_media_source'\n", "\n", "# AWS account ID\n", "account_id = boto3.client(\"sts\").get_caller_identity()[\"Account\"]" ] }, { "cell_type": "markdown", "id": "e4b52bea", "metadata": {}, "source": [ "## Set up application\n", "\n", "Every application uses the creator's AWS Account ID as the prefix to uniquely identifies the application resources. Running `panorama-cli import-application` replaces the generic account Id with your account Id." ] }, { "cell_type": "code", "execution_count": null, "id": "1159db0b", "metadata": {}, "outputs": [], "source": [ "!cd ./lab3 && panorama-cli import-application" ] }, { "cell_type": "markdown", "id": "12f0ef89", "metadata": {}, "source": [ "## Download Depedencies and Artifacts (One Time Download)" ] }, { "cell_type": "code", "execution_count": null, "id": "a39811ab", "metadata": {}, "outputs": [], "source": [ "panorama_test_utility.download_artifacts_gpu_sample('lab3', account_id)" ] }, { "cell_type": "markdown", "id": "d0742bd9", "metadata": {}, "source": [ "### Upload application to Panorama for deploying to devices" ] }, { "cell_type": "code", "execution_count": null, "id": "bd094bc8", "metadata": {}, "outputs": [], "source": [ "container_asset_name = 'lab3'" ] }, { "cell_type": "code", "execution_count": null, "id": "1556b97d", "metadata": {}, "outputs": [], "source": [ "# This step takes some time, depending on your network environment.\n", "!cd ./lab3 && pwd && panorama-cli package-application" ] }, { "cell_type": "markdown", "id": "bb6974a4", "metadata": {}, "source": [ "### Ready for deploying to a device\n", "\n", "Congrats! Your app is now ready to deploy to a device. Next, you can continue in this notebook to deploy the app programmatically or you can go to the Panorama console and deploying using the AWS Console. The console makes it easier to select camera streams and select the devices you want to deploy to. Programmatic deployment is faster to complete and easier to automate." ] }, { "cell_type": "markdown", "id": "bd7bc315", "metadata": {}, "source": [ "### How to deploy to the device?" ] }, { "cell_type": "markdown", "id": "3af08a01", "metadata": {}, "source": [ "The Workshop document has detailed instructions on how to deploy. Please go to the deployment section of Workshop document and follow along the instructions" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 5 }