My main motivation for working on this was to help low-budget charity organizations comply with regulations such as GDPR and French Privacy law to protect the privacy of those they have pictures of. It could also be used by organizations fighting human trafficking to protect the identities of victims.

What it does

When a user uploads an image to an S3 bucket, it triggers an AWS Lambda function that passes the image to AWS Rekognition to identify faces. It then takes in the facial bounding boxes and censors them with solid fill. It then saves the final image to an S3 bucket with the same key it was uploaded with.

How I built it

I used the AWS Lambda Python execution environment and the Pillow Python library to run the code in the Lambda function. I used the Serverless Application Model to define and package the model for the Serverless Application Repo. I also added the output and input buckets to be separate so that it could be integrated into a longer image processing pipeline.

Challenges I ran into

I had some trouble working with the SAM templates at first. I was originally basing my design off of some of the examples in the repo, but as it turned out, those were flawed. I also ended up needing a new policy template which I submitted as a pull request to the SAM Repository.

Accomplishments that I'm proud of

I'm particularly proud of submitting code to the SAM Template project and making a useful application for the SAR that's universal enough for many people to use.

What I learned

I learned a lot about writing and debugging serverless applications. I also learned a bit about working on large open source projects like the SAM Template repository.

What's next for Serverless Facial Censor

I am considering creating a version of the SAR app with OpenCV instead of AWS Rekognition to see if it reduces the resources used by the application. However I also wanted to enter the AWS AI hackathon so I probably won't do that until it's done as well.

I could also potentially add to the SAM template to only trigger the function when images are uploaded to the bucket or under a certain key in the bucket. I didn't do that for this hackathon in order to limit complexity, but it could be a desirable feature.

Built With

Share this project: