With Amazon SageMaker

This step-by-step tutorial will help guide you though creating a model using Amazon SageMaker and importing it to an AWS DeepLens model. AWS DeepLens is a fully programmable video camera that comes with tutorials, code, and pre-trained models designed to expand deep learning skills.

You will need an AWS DeepLens device in order to complete this tutorial. You can pre-order now on amazon.com.

If this is your first time using your AWS DeepLens check out the How to Configure AWS DeepLens and the Creating and Deploying an AWS DeepLens Project tutorials to help you get started.

Completing this tutorial requires an AWS account

Create a Free Account

Open the AWS Management Console in a new browser window, so you can keep this step-by-step guide open.  When the screen loads, enter your user name and password to get started. Then type SageMaker in the search bar and select Amazon SageMaker to open the console.

t4s1

(click to zoom)

t4s1

In this step, you will set up and configure an Amazon SageMaker notebook instance.


a. Launch an Amazon SageMaker notebook by selecting Create notebook instance in the Get started section on the right side of the screen.

 

 

t4s2

(click to zoom)

t4s2

b. Under the Notebook instance settings section complete the following steps: 1) Give your notebook a name (for example, “HotDogDetection”), 2) Select a Notebook instance type (for example, ml.t2.medium, which is the smallest and lower cost), and 3) Select Create a new role.

t4s3

(click to zoom)

t4s3

c. On the Create an IAM role screen, under S3 buckets you specify - optional, select None. Keep all the other default values as is to allow SageMaker related buckets and objects to be accessed. Select Create role.

t4s4

(click to zoom)

t4s4

d. Back on the Create Notebook instance screen, select the IAM role that you just created in step 2.c. and then select Create notebook instance. The other values for VPC and KMS are not necessary for this simple tutorial, but should be used when using real private data.

t4s5

(click to zoom)

t4s5

e. Return to Amazon SageMaker Console, wait for the notebook status to turn from Pending to InService and select Open.

t4s6

(click to zoom)

t4s6

In this step, you will work within the Jupyter notebook, import a model from github, link it to an S3 bucket, and run cells.


a. Once the Jupyter notebook is open, select New and then Terminal, to open a new terminal to retrieve the tutorial notebook. You will use the tutorial notebook to a custom model.

t4s7

(click to zoom)

t4s7

b. Now, you will retrieve the notebook from the git repository. In the terminal, change to the SageMaker directory by entering: cd SageMaker . Next, clone the repository from GitHub by entering: git clone https://github.com/aws-samples/reinvent-2017-deeplens-workshop.git

t4s8

(click to zoom)

t4s8

c. Return to the Jupyter Home screen and navigate to the notebook by selecting the reinvent-2017-deeplens-workshop folder.

t4s9

(click to zoom)

t4s9

d. In the folder, navigate to the lab session 3 folder, and select the notebook named deeplens-hotdog-or-not-hotdog.ipynb.

t4s10

(click to zoom)

t4s10

e. To write its output the model needs an S3 Bucket. So, now open the S3 Console, and select Create Bucket.

t4s11

(click to zoom)

t4s11

f. Name the bucket with the deeplens-sagemaker- prefix, to allow AWS DeepLens and Amazon SageMaker to access it, and append it with your name for uniqueness. Under Region, select US East (N. Virginia), to align with the notebook region, and select Create in the bottom left corner.

t4s12

(click to zoom)

t4s12

g. Next, scroll down the notebook cells to the cell with the S3 Bucket name, and assign the name of the S3 bucket you created (for example, deeplens-sagemaker-myname), and from the Cell menu at the top of the Jupyter page select the option Run all.


 

t4s13

(click to zoom)

t4s13

In this final step, you will learn how to import the model you just created into an AWS DeepLens model.


a. Once all the cells have finished running (this is indicated by the * beside each cell turning into a sequence number), navigate to the AWS DeepLens Console and select Models then Import model.
 

t4s14

(click to zoom)

t4s14

b. In the Import source section, select Externally trained model, and under Model settings, point to the S3 Bucket you created and the folder that was used to output the model (for example, S3://deeplens-sagemaker-myname/test/). Give it a name (for example, Hotdog-or-not) and a description, then select Import.
 

t4s15

(click to zoom)

t4s15

c. To verify the model import, navigate to the Models page. The newly created model should appear in the list of available models, after the list of the built-in models. The model is ready now to be included in a project and deployed to your device.

t4s16

(click to zoom)

t4s16

You have created your first model using Amazon SageMaker and imported it to an AWS DeepLens model! 

You can now include this in a project alongside an AWS Lambda function, and deploy it to the camera for local inference.

Now that you have deployed a model to AWS DeepLens, pick one of the following options to further expand your knowledge.

Dive deeper

Get more info on how to use AWS DeepLens.

Getting Started Guide >>

Learn more

Learn how to customize and display project output from AWS DeepLens on an HTML page. 

Read the Blog Post >>

Build a project

Get an overview of training a model with Amazon SageMaker and extending it with AWS Lambda.

Read the Blog Post >>

Yes
No