Fun Project for getting started with AI: Rekognition DetectText
Veliswa_Boya πΏπ¦
Posted on November 6, 2020
AWS offers a comprehensive set of services and APIs for Artificial Intelligence and Machine Learning.
What's awesome about this is that this set of services caters for both customers without ML skills and those looking for advanced functions.
I recently created an application that uses the Rekognition DetectText API.
Rekognition offers Image and Video APIs. The following Image APIs are available:
- Labels
- Custom Labels
- Content Moderation
- Face Detection and Analysis
- Face search and verification
- Celebrity Recognition
- Personal Protective Equipment (PPE) detection
- Text detection
I recently created what would be a back-end of an application that receives images which contain text. The back-end (Python) calls the Rekognition DetectText API which extracts the text, receives the extracted text and concatenates this text into a string. The string is then published to an SNS topic as a message where all those subscribed will receive this message.
The Architecture Design of the solution
SNS Topic: Create a topic accordingly, with the relevant subscriptions
S3 Bucket: Create an S3 bucket and grant the necessary permission.
If there needs to be public access, allow this through
the access control lists (ACLs), bucket policies, access point policies, etc.
Lambda Function: modify the Basic Lambda Execution role to include the following policies (in addition to the default policy assigned at role creation):
AmazonRekognitionReadOnlyAccess
AmazonS3ReadOnlyAccess
AmazonSNSFullAccessLastly, include the following resource-based policy, so that S3 can trigger the Lambda on PutObject of the image:
The complete code is available in my github repository and the sample is as below:
Conclusion
I hope this gets you started on AWS AI if you haven't already - and that you find your own use cases that will have you build even more fun (or useful :)) AI applications.
Posted on November 6, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.