DEV Community

Cover image for Fun Project for getting started with AI: Rekognition DetectText
Veliswa_Boya ๐Ÿ‡ฟ๐Ÿ‡ฆ for AWS Heroes

Posted on โ€ข Edited on

8 2

Fun Project for getting started with AI: Rekognition DetectText

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 
Enter fullscreen mode Exit fullscreen mode

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

Alt Text

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.

Alt Text

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
AmazonSNSFullAccess

Alt Text

Lastly, include the following resource-based policy, so that S3 can trigger the Lambda on PutObject of the image:

Alt Text

The complete code is available in my github repository and the sample is as below:

Alt Text

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.

API Trace View

Struggling with slow API calls? ๐Ÿ•’

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more โ†’

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

๐Ÿ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay