Introduction to Amazon SageMaker

Amazon SageMaker is a fully managed platform that enables data scientists and developers to build, train, and deploy machine learning models at any scale.

It provides a comprehensive set of tools and features to simplify the entire machine learning lifecycle, from data preparation to model deployment.

Let's see a real example without ML terminology and other fluff.

1. Open the Amazon SageMaker service from the AWS console, click "Studio", and then "Create a SageMaker domain".

2. Select "Set up for single user (Quick Setup), and click "Set up".

You will see a warning message "Preparing SageMaker Domain. Please do not close this browser tab. We are configuring the resources needed by the domain. This is a one-time configuration and may take a few minutes."

3. When the domain becomes ready, click on "Launch" dropdown and select "Studio".

4. Select JupyterLab from the top left corner.

5 Click "Create JupyterLab space".

6. Provide space name, for example, "intro". Click "Create space" button.

7. Click "Run space" and wait until the "Open JupyterLab" button becomes active. Click on it.

8. Click "Python 3" icon under "Notebook" section.

9. When Jupyter editor is ready, type

import sagemaker
print(sagemaker.__version__)

to see that SageMaker works as expected.

10. Now go back to SageMaker Studio and click on "JumpStart" menu on the left. Select "YOLO V3 DarkNet 53" model and "Deploy" it.

11. When the model is deployed, click on the "Test inference" tab, then "Use Python SDK example code", and then "Open in JupyterLab", and choose the workspace created in the article.

You should see Python code automatically inserted.

12. Create a new unique S3 bucket and upload any image. To show the complete example, I've created a bucket with the name "sg-experiment" and uploaded the image of cats "cat_test.png".

13. In the Python code, update the S3 bucket and image names to match the ones you just created.

s3_bucket = f"sg-experiments"
img_jpg = "cat_test.png"

14. Run the code. The objects in your image should be accurately identified.

That's it. You can explore the model's capabilities with various images. Just remember to shut down the endpoint and JupyterLab to prevent unnecessary expenses.

Subscribe to AWS by Vlad Frantskevich

Don’t miss out on the latest issues. Sign up now to get updates.
jamie@example.com
Subscribe