Skip to content

Table orientation issues with Textract

0

I am using Document Analysis endpoint to detect tables in scanned images. I have attached an example input image (refer to first attachment) where the table is upright with headers located in the top row, as expected. However, when processing this image through the endpoint, the detected table is rotated by 90 degrees (refer to the output image attached). As a result, the headers—which should be the top row—are being interpreted as the rightmost column in the extracted data.

Additionally, there are significant OCR errors present in the table cells in the extracted output, which are not present in the original image.

Summary of Issues:

  • Rotation Error: The table is rotated 90 degrees in the output, with headers appearing as a column instead of the header row.
  • OCR Quality: The text extracted from table cells contains significant inaccuracies, even though the original image is clear.

Attachments: Input output

we're facinng issues with table orientation when using the document analysis endpoint, for both images and PDFs. Tables are often rotated (sometimes 90 or 180 degrees, or even flipped) in the output, even though the originals are correctly oriented. This isn't a one-off; it's happening with many pages and tables.

asked a year ago558 views

1 Answer
0

The issues you're experiencing with AWS Textract regarding table orientation and OCR quality are known challenges that can occur during document analysis.

For the table orientation problem, Textract includes rotation information as part of its Geometry object. The service detects rotation angles between 0 and 360 degrees for text elements. In your case, it appears that Textract is incorrectly interpreting the orientation of your table, causing the 90-degree rotation where headers are appearing as a column instead of a row.

There are several potential approaches to address these issues:

  1. Image Quality: Ensure your scanned documents have high resolution, good contrast, and are properly aligned. Poor image quality can affect both orientation detection and OCR accuracy.

  2. Pre-processing: Consider pre-processing your images before submitting them to Textract. This might include:

  • Explicitly correcting the orientation
  • Enhancing contrast between text and background
  • Removing noise or artifacts
  1. Post-processing: Implement post-processing logic to:
  • Check and correct the orientation based on the rotation angle provided in the Geometry object
  • Transpose the table data if needed to correct the orientation
  • Apply validation rules to identify and correct common OCR errors
  1. Table Structure: If possible, ensure your tables have clear borders and consistent formatting, as complex table structures can sometimes confuse Textract's analysis.

For the OCR quality issues, Textract sometimes struggles with certain fonts, handwritten text, or special characters. The quality of the original document significantly impacts recognition accuracy. If the OCR errors persist despite having clear input images, you might need to implement additional validation and correction logic in your application.

If these issues continue despite your best efforts, it might be worth contacting AWS Support for more specific guidance, as they may be able to provide insights into any known limitations or upcoming improvements to the service.
Sources
Textract Layout Response Not In Document Order | AWS re:Post
Recognition of '1' from table filled in by hand | AWS re:Post
Locating Items on a Document Page - Amazon Textract

answered a year 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.