English | 简体中文
Common Machine Learning Features Kit
Documentation · Changelog · Feature List
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 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 |
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 |
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 |
Feature Name | Description |
---|---|
Image Super Resolution | Upscale the resolution and enhance details in the images |
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 |
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/
You can also build this project from source.
- 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
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/
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
-
Sending API requests to Amazon API Gateway. The request payload needs to contain the processed image or text.
-
Amazon API Gateway sends received user requests directly to AWS Lambda functions.
-
The AWS Lambda function returns the result(JSON format) to the caller.
- Building on Amazon SageMaker
-
Sending an API request to Amazon API Gateway. The request payload needs to contain the processed image or text.
-
Amazon API Gateway sends the request to the AWS Lambda function.
-
AWS Lambda invokes Amazon SageMaker Endpoint, executes the inference in Amazon SageMaker and returns results (JSON format).
See API Reference
By default, the AI Gateway will enable the IAM authorization and Enable the CloudWatch Logs for accessing and debugging.
This project is licensed under the Apache-2.0 License.