Skip to content

Machine Learning APIs for common use cases, include: General OCR (Simplified/Traditional Chinese), Custom OCR, Image Similarity, Object Recognition, Face Detection, Face Comparison, Human Image Segmentation, Human Attribute Recognition, Pornography Detection, Image Super Resolution, Text Similarity, Car License Plate, etc.

License

Notifications You must be signed in to change notification settings

awslabs/aws-ai-solution-kit

English | 简体中文

AI Solution Kit

Common Machine Learning Features Kit

Documentation · Changelog · Feature List

Apache 2.0 License Build badge Build badge


Introduction

This repository contains several pre-trained deep learning models based on AWS Lambda and Amazon SageMaker, for example: general OCR, text similarity, face detection, human image segmentation, image similarity, object recognition, image super resolution (see full list below). By this project, you can download these dockerized modules from Amazon Elastic Container Registry(ECR) and create REST APIs on Amazon API Getaway. Once the project deployed, you can call the REST API to use these features easily.

For more information about the solution, please refer to our website.

Feature List

Optical Character Recognition(OCR)

Feature Name Description
Lite OCR (Simplified Chinese) Recognize and extract Simplified Chinese, numbers, alphabetical characters and symbols
Lite OCR (Traditional Chinese) Recognize and extract Traditional Chinese, numbers, alphabetical characters and symbols
Advanced OCR (Multilingual) Recognize and extract Simplified/Traditional Chinese, Vietnamese, Japanese, Korean, English, numbers, alphabetical characters and symbols. Return the information such as text or coordinates
Custom OCR Recognize and extract structured text by predefined OCR templates
Car License Plate Recognize text on Chinese car license plate

Facial & Body

Feature Name Description
Face Comparison Compare two faces of same person and return a confidence score of the similarity
Face Detection Detect the face in a image and return coordinate information of the face
Human Attribute Recognition Recognize the attributes of the human body in the image
Human Image Segmentation Segment human bodies from background and return the alpha channel

Image Understanding

Feature Name Description
Image Similarity Compare two images and return similarity score
Object Recognition Segment human bodies from background and return the alpha channel
Pornography Detection Detect pornographic image in three dimensions (normal, sexy, porn) and return confidence scores

Computer Vision Production

Feature Name Description
Image Super Resolution Upscale the resolution and enhance details in the images

Natural Language Understanding(NLU)

Feature Name Description
Text Similarity Compare two Chinese words or sentences and return similarity score
General NLU Support a variety of Chinese text understanding tasks, such as text classification, sentiment analysis, extraction, and customizable labeling systems

Quick deployment

This project is an AWS Cloud Development Kit(CDK) project written in Typescript, if you want to use the above deep learning features without building the entire project, you can use the Amazon CloudFormation template to deploy feature APIs quickly, the generated Amazon CloudFormation template is available at: https://aws-gcr-solutions.s3.amazonaws.com/Aws-gcr-ai-solution-kit/v1.4.0/AI-Solution-Kit.template

Below is the quick links to launch the AWS CloudFormation template into your AWS account

Region name Region code Launch
Global regions(switch to above region you want to deploy) us-east-1(default) Launch
AWS China(Beijing) Region cn-north-1 Launch
AWS China(Ningxia) Region cn-northwest-1 Launch

Once the AWS CloudFormation template is opened in your AWS account, you can choose the deep learning features in the Parameters section, the step-by-step instruction is available at: https://awslabs.github.io/aws-ai-solution-kit/en/deployment/

Build from source

You can also build this project from source.

Prerequisites

  • An AWS account
  • Configure credential of aws cli
  • Install node.js LTS version, such as v14.x
  • Install Docker Engine
  • Install the dependencies of solution via executing command
yarn install && npx projen
  • Initialize the CDK toolkit stack into AWS environment(only for deploying via AWS CDK first time)
yarn cdk-init

Deploy project

You can clone this repository to create a local copy on your computer and build this project in root directory by yarn.

  • [Optional] Build docker images by yarn and push to an Amazon ECR repository
yarn build-containers

You can push images to an Amazon ECR repository, the step-by-step instructions is available at: https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html

Once the docker images pushed to Amazon ECR repository, please replace the ecr registry in .projenrc.js file in project root directory.

context: {
    ecrRegistry: 'your-ECR-registry',
}
  • Build CDK project
yarn build
  • Deploy CDK project

Note If you do not build docker images, the ECR registry for pre-trained images will use default 'public.ecr.aws/aws-gcr-solutions/aws-gcr-ai-solution-kit'

Once the project built, you can deploy to your AWS account.

yarn deploy

Once the project deployed, please log in to your AWS console, choose to active deep learning features by updating the Amazon CloudFormation stack. The step-by-step instructions is available at: https://awslabs.github.io/aws-ai-solution-kit/en/deploy-add-delete-api/

Architecture

This project contains two types of implementation: Building on AWS Lambda and building on Amazon SageMaker.

Note The Amazon SageMaker type implementation is only available for image super-resolution feature.

  • Building on AWS Lambda

Architecture

  1. Sending API requests to Amazon API Gateway. The request payload needs to contain the processed image or text.

  2. Amazon API Gateway sends received user requests directly to AWS Lambda functions.

  3. The AWS Lambda function returns the result(JSON format) to the caller.

  • Building on Amazon SageMaker

Architecture

  1. Sending an API request to Amazon API Gateway. The request payload needs to contain the processed image or text.

  2. Amazon API Gateway sends the request to the AWS Lambda function.

  3. AWS Lambda invokes Amazon SageMaker Endpoint, executes the inference in Amazon SageMaker and returns results (JSON format).

API Reference

See API Reference

Authorization and Security

By default, the AI Gateway will enable the IAM authorization and Enable the CloudWatch Logs for accessing and debugging.

License

This project is licensed under the Apache-2.0 License.

About

Machine Learning APIs for common use cases, include: General OCR (Simplified/Traditional Chinese), Custom OCR, Image Similarity, Object Recognition, Face Detection, Face Comparison, Human Image Segmentation, Human Attribute Recognition, Pornography Detection, Image Super Resolution, Text Similarity, Car License Plate, etc.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published