The project is about moderating images using AWS Rekognition. It uses the DetectLabels and DetectModerationLabels API to perform image moderation.
To get started with the project on your own AWS account, clone the project from Github.
The project relies on certain tools/softwares/libraries that are listed below. The entire deployment is done from the local machine to AWS.
- Terraform
- Java
- Maven
- AWS (credentials configured using AWS cli)
- Commitizen (It is the Python library that was used for versioning, conventional commits and for generating changelog.) For details around the set up of commitizen and its usage check here
- Python (only for Commitizen and pre-commit)
- pre-commit
The steps to install the application to AWS from the local machine are listed below.
- Clone the repo
git clone https://github.com/rkikraari/imagemoderation.git
- Go to the cloned project directory.
cd imagemoderation
- Execute the maven command. It creates a fat jar which is used to by terraform for the Lambda deployment
mvn clean package assembly:single
- The repo supports working with 2 AWS Rekognition APIs i.e. DetectLabels and DetectModerationLabels API.
- The source code for the API is split based on the APIs. You will find two packages
- com.learn.aws.rekognition.api.detectlabels (Supports the DetectLabels API)
- com.learn.aws.rekognition.api.detectmoderationlabels (Supports the DetectModerationLabels API)
- Based on the API that you want to use for your image moderation you can use either the detectlabels or detectmoderationlabels folder in terraform
- Go to terraform directory
cd terraform
- Go to either detectlabels or detectmoderationlabels folder based on your requirement.
cd detectlabels
OR
cd detectmoderationlabels
- Go to provider.tf file and modify the values of shared_config_files and shared_credentials_files. Ensure you have done aws configure locally.
- Execute the terraform init command
terraform init
- Execute the terraform plan command
terraform plan
- If happy with the plan, execute the terraform apply command
terraform apply
Once the deployment is successful, go to the AWS account. Go to the S3 bucket created as part of the depoyment and upload the image you want to moderate. You can use the sample images added in the project for testing purposes. After sucessfully uploading the image to the S3 bucket, check the AWS Lambda logs in CloudWatch to see the results. You can also look at DynamoDB to see the results in it. The results would only be updated in DynamoDB if moderation is required for an image else no entries are made to the DynamoDB.
- A web frontend to upload the images
- CI/CD pipeline to deploy instead of using local set up
- Use terraform to manage CloudWatch
- Persists the labels returned by the API in DynamoDB
- Addition of more Unit tests