Skip to content

Combining Sage Maker with Textract

0

We are looking to build solution which extracts data from PDF file and turns that into a more structured data that we can use on our application.

We tried the DocumentAnalysis from Textract which reads the data from PDF but it would be too cumbersome to extract the meaningful details that we need.

Then we realised we may need to combine the results from Textract and feed that to SageMaker AI - build models, etc. - which should then allow us to extract the informaiton based on the models we will train in SageMaker AI.

But we are not sure how to get started with these.

We can across below link but it's 3 years old so not sure if it's still relevant based on the changes that were done to SageMaker after this article was published.

https://aws.amazon.com/blogs/machine-learning/bring-structure-to-diverse-documents-with-amazon-textract-and-transformer-based-models-on-amazon-sagemaker/

Anyone has done something similar before and can guide us in the right direction would be much appreciated.

asked 2 years ago358 views

2 Answers
0

Your approach to combining Amazon Textract with Amazon SageMaker for extracting structured data from PDF files is a solid strategy. While the specific article you mentioned might be a few years old, the general concept of using Textract for initial text extraction and then leveraging SageMaker for further processing and model training is still very relevant and widely used.

Here's a high-level overview of how you can approach this:

  1. Use Amazon Textract to extract raw text, forms, and tables from your PDF documents. Textract's DocumentAnalysis API can handle complex layouts and provide you with a JSON output containing the extracted information.

  2. Process the Textract output to create a dataset suitable for training machine learning models. This might involve cleaning the data, structuring it, and potentially labeling it if you're planning to use supervised learning techniques.

  3. Use Amazon SageMaker to build, train, and deploy machine learning models that can further process and structure the data extracted by Textract. SageMaker offers a wide range of built-in algorithms and also supports custom algorithms, allowing you to choose the best approach for your specific use case.

  4. Implement a workflow that combines these steps. You could use AWS Lambda functions to trigger Textract when new documents are uploaded to an S3 bucket, then use Step Functions or SageMaker pipelines to orchestrate the entire process from extraction to model inference.

  5. For cases where the model's confidence is low or for critical data points, you might want to incorporate human review. Amazon Augmented AI (A2I) can be integrated with both Textract and SageMaker to facilitate human review when needed.

To get started, you could create a SageMaker notebook instance to experiment with processing Textract outputs and building initial models. As you refine your approach, you can then move towards a more automated, production-ready pipeline.

Remember that the exact implementation will depend on the specific information you're trying to extract and the structure of your documents. You may need to iterate on your models and potentially use techniques like transfer learning or custom model architectures to achieve the best results for your use case.

If you need more detailed guidance, AWS provides extensive documentation and examples for both Textract and SageMaker, and there are many community resources available that demonstrate similar workflows.

Sources
Use Amazon Augmented AI with Amazon Textract - Amazon SageMaker AI
Automatically extract content from PDF files using Amazon Textract - AWS Prescriptive Guidance
Community | Intelligent Document Processing With Augmented AI
Augmented AI - Accenture Enterprise AI – Scaling Machine Learning and Deep Learning Models
Create a document lake using large-scale text extraction from documents with Amazon Textract | AWS Machine Learning Blog

answered 2 years ago

0

Alternatively you can convert PDF pages into images and ask one of the Generative AI models on Amazon Bedrock (Claude/Nova) to extract the relevant data from images

AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.