Blurring Pictures with Amazon Rekognition
Our usecase :
We were working on a serverless web application built with AWS Amplify, that required to blur workers and License Plates - for data protection regulations - from Images that some cameras produced. Images were produced every 5min from around 200 cameras. Between the options we had to build this solution, we found many third party solutions available for AI based face detection, but isn't there an easier and most importantly CHEAPER solution? Without SageMaker or any servers.. ? YES
What are Amazon Rekognition and Custom Labels?
Amazon Rekognition :
Amazon Rekognition makes it easy to add image to your applications using proven, highly scalable, deep learning technology that requires no machine learning expertise to use.
Amazon Rekognition Custom Labels :
Amazon Rekognition Custom Labels allow you to identify objects and scenes in images that are specific to your business needs. For our usecases the labels were : Persons and License Plates. The issue with Rekognition Custom Labels is its price : 4,44$ per hour for ireland region. That explains why we didn't use it for live blurring, but we used instead normal Rekognition, and once a day ( around 1h per day, depending of number of images ) we use Custom Labels with batch processing to improve our blurring.
Why use Amazon Rekognition Custom Labels :
After several testing for the pictures our cameras were producing, we faced a challenge that the persons ( actually workers in construction sites ) were not always recognized by Amazon rekognition because of their pose, equipment, etc... We had to train a new model with Amazon rekognition Custom Labels for workers but also License Plates ( since Rekognition don't offer License Plates in its default labels ):
- Rekognition Custom Labels offers a new way of building models that requires no Machine Learning knowledge :
- This evaluation summary shows the results of testing our trained model with the test dataset we provided. This helps understand the overall performance of the model:
Our Solution's Architecture :
In our solution's architecture we had the following components:
- Lambda 1 triggered by dynamodb at image creation blurs Persons with Amazon Rekognition.
- Lambda 2 was triggered by a CloudWatch Event once a day and queries images to be blurred again for the day. Creates SQS Messages and starts the Rekognition Custom Labels.
- Lambda 3 triggered by SQS, blurs Persons and License Plates with Amazon Rekognition Custom Labels, Stops the Custom labels when the queue is empty.
Depending on your usecase, Amazon Rekognition is often enough for your objects/scenes detections, but if you have a very specific Label you want to detect: You can use Rekognition Custom Labels by training the model for your exact Label, but watchout for the pricing : Use our solution! Blur pictures live with Amazon Rekognition and once a day, improve your blurring. I want to finish this post by saying that I was pleasantly surprised that without any previous Machine Learning knowledge I was able to implement such a solution. 🚀
Detect noncompliant Lambda runtimes in your environment
Use AWS Config Rules to detect noncompliant Lambda runtimes
Our first serverless Beer Tasting
Organization of our first serverless Beer Tasting - a mix of online Beer Tasting and serverless meetup
Cut down on your Lambda cost
What to keep in mind when focussing on optimizing cost for Lambda