• About Me
  • Projects
  • WebApp
  • Archive

Barnaby Baron. Exploring AWS.

  • Building an automated serverless facial analysis system.

Building an automated serverless facial analysis system.

2024-05-16 3 min read Projects Barny Baron

Journey: 📊 Community Builder 📊

Subject matter: Building on AWS

Task: Building an automated serverless facial analysis system.

This project is about Performance, Availability, and receiving real-time notifications when new analysis is performed.

Using the 6 Pillars of the AWS Well-Architected Framework, Performance Efficiency and Sustainability will be achieved in this build.

I will be setting up a Serverless Machine Learning service to analyse new image uploads and then perform real-time notifications to the Administrator of its findings.

Machine Learning

Credit: This serverless architecture was created using some guidance from Edithcherotich on Medium Here.

What did I use to build this environment?

  • Amazon S3
  • AWS Lambda
  • Amazon Rekognition
  • Amazon DynamoDB
  • Amazon SNS
  • AWS IAM
  • Amazon CloudWatch

What is built?

  • A new S3 bucket which triggers a Lambda Function
  • Amazon Rekognition is used to detect faces in newly uploaded images
  • An SNS Topic to receive calls for email distribution
  • An SNS Subscription to the new Topic
  • A DynamoDB Table for Amazon Rekognition to populate data into if a face is detected
  • An SNS trigger to notify an Admin if a face is detected, confirming the expected gender and age

This task involved using Amazon Rekognition to analyse new images that are uploaded to an S3 bucket. AWS Lambda triggers the analysis. If a face is detected by Amazon Rekognition, it determines the gender and age of the person before then populating it into a DynamoDB table. Lambda then triggers an SNS notification via email to the Account Administrator.

I also used the following AWS documentation:

https://docs.aws.amazon.com/sns/latest/dg/sns-getting-started.html

https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html

https://docs.aws.amazon.com/sns/latest/dg/sns-create-subscribe-endpoint-to-topic.html

Once I had configured all of the areas, I uploaded a photo of a person into my S3 bucket with the titles ‘celebrating.jpg’ and ‘professional.jpg’ so as not to show gender bias. AWS Lambda triggered off the upload and Amazon Rekognition confirmed a face was present, identified the likely gender and age, and sent a real-time notification to my mailbox.

As a further test, I then uploaded a photo of ‘coffee.jpg’ to my S3 bucket and did not receive any email.

When checking the CloudWatch logs, I identified an error that ‘gender could not be defined’, which is expected behaviour. If we wanted to take the code further, error handling could be introduced to send an email notification of a non-human image detected.

Some of the highlights…

Amazon S3:

S3 bucket

AWS Lambda:

Lambda Code

S3 images uploaded:

Person

Person

DynamoDB table populated:

DynamoDB Table

CloudWatch:

Celebrating

Professional

SNS:

SNS

SNS Subscription:

Subscriber

Email notification:

Email Notification

Email Notification

Additional test with an image upload of a coffee cup - expected result would be an error and no notification:

Coffee

CloudWatch logging an error:

Coffee

I had great difficulty with getting the Lambda Function code to work, but I got there in the end with a lot of trial and error.

I might have to try and find some time to do some Python courseware at some point!

My interpretation of the architecture:

Architecture

I hope you have enjoyed the article!

Cloud

Community Builder Serverless Rekognition
Latest posts
  • Designing a Formula 1 Race Track and gaining insights from Amazon Nova
  • Year 2 - AWS Community Builder
  • Troubleshooting an EKS Pod creation error - Persistent Volume Controller Failed Binding
  • Building an EKS cluster and mounting an S3 bucket within a pod using the CSI Driver
  • Sopra Steria Merch Delivery!
  • AWS Community Builders Application Window!
  • Building a VPC and provisioning an EC2 instance using Modules!
Categories
  • AWS News (84)
  • Projects (29)
  • Exploring (19)
  • Troubleshooting (10)
  • General (8)
  • Quotes (5)
  • Video (3)
Social media
Archive
© 2025 by Barny Baron
Powered by Bilberry Hugo Theme