Skip to content

aws-samples/amazon-sagemaker-inference-using-tensorflow-hub-ready-model

Amazon SageMaker inference using Tensorflow Hub ready model

Description

This sample code repo will demonstrate how we can use a ready model found on Tensorflow Hub as a bring your own container to Amazon SageMaker, and use it as an endpoint for inference.

The model selected for this demonstration is an object detection model trained on Open Images V4 with ImageNet pre-trained Inception Resnet V2 as image feature extractor that can be found here

The repository contains a notebook that will explain each step in the build and deploy process.

This notebook was tested on Amazon SageMaker Notebook Instance ml.t3.medium with python3 environment with access to S3, ECR, Amazon SageMaker, and docker installed.

Notice: This sample code uses AWS Resources such as SageMaker Notebook Instance to run the notebook and Amazon SageMaker endpoint with ml.g4dn.xlarge for inference, please make sure to clean up to avoid additional costs when finishing reviewing this sample.

Implementation

This project designed to run inference on images that were uploaded to S3. A possible architecture diagram that can use this:

diagram

  1. A client upload an image to S3 and sends a POST request to API Gateway
  2. API Gateway proxies the request to a lambda
  3. Lambda sends an inference request to Amazon SageMaker
  4. SageMaker returns the inference results to lambda
  5. Lambda creates a new image according to the inference results and stores it in S3
  6. Lambda returns a CloudFront URL back to the client to download the inference image

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

Sample code to run Amazon SageMaker endpoint for inference with a ready model from Tensorflow Hub

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published