{ "cells": [ { "cell_type": "markdown", "id": "1b502ffc", "metadata": {}, "source": [ "## Lab 1. Object detection\n", "\n", "This notebook is intended to be run along with the [Workshop document](https://catalog.workshops.aws/panorama-immersion-day/en-US/20-lab1-object-detection/21-lab1)." ] }, { "cell_type": "markdown", "id": "2a8942ed", "metadata": {}, "source": [ "## Preparation" ] }, { "cell_type": "code", "execution_count": null, "id": "4ca08917", "metadata": {}, "outputs": [], "source": [ "# Import libraries\n", "\n", "import sys\n", "import os\n", "import json\n", "import glob\n", "import tarfile\n", "\n", "import boto3\n", "import sagemaker\n", "import IPython\n", "import gluoncv\n", "\n", "sys.path.insert( 0, os.path.abspath( \"../common/test_utility\" ) )\n", "import panorama_test_utility" ] }, { "cell_type": "code", "execution_count": null, "id": "fb4b9b77", "metadata": {}, "outputs": [], "source": [ "# Initialize variables and configurations\n", "\n", "boto3_session = boto3.session.Session()\n", "sm_session = sagemaker.Session()\n", "\n", "account_id = boto3.client(\"sts\").get_caller_identity()[\"Account\"]\n", "region = boto3_session.region_name\n", "s3_bucket = sm_session.default_bucket()\n", "sm_role = sagemaker.get_execution_role()\n", "\n", "print( \"account_id :\", account_id )\n", "print( \"region :\", region )\n", "print( \"s3_bucket :\", s3_bucket )\n", "print( \"sm_role :\", sm_role )" ] }, { "cell_type": "markdown", "id": "ad6a50dc", "metadata": {}, "source": [ "## \"Hello World!\" application" ] }, { "cell_type": "code", "execution_count": null, "id": "827c3043", "metadata": {}, "outputs": [], "source": [ "app_name = \"lab1\"\n", "\n", "!panorama-cli init-project --name {app_name}" ] }, { "cell_type": "code", "execution_count": null, "id": "0990fe4d", "metadata": {}, "outputs": [], "source": [ "code_package_name = f\"{app_name}_code\"\n", "code_package_version = \"1.0\"\n", "source_filename = f\"./{app_name}/packages/{account_id}-{code_package_name}-{code_package_version}/src/app.py\"\n", "\n", "!cd {app_name} && panorama-cli create-package --type Container --name {code_package_name} --version {code_package_version}" ] }, { "cell_type": "markdown", "id": "3c0f2e6b", "metadata": {}, "source": [ "