aws-samples / amazon-textract-transformer-pipeline

Post-process Amazon Textract results with Hugging Face transformer models for document understanding
MIT No Attribution
92 stars 26 forks source link

Support image files in notebook 1 data prep #9

Closed athewsey closed 2 years ago

athewsey commented 2 years ago

Update the build_data_manifest utility to support single-page image format documents, for which the pdf2image_regex isn't applicable to look up cleaned images in S3 from input file.

Issue #, if available: #5

Description of changes:

Update/fix the build_data_manifest utility function to support single-page image format documents.

Previously, this function assumed the pdf2image_regex was applicable to all input documents: But the preprocessing job outputs don't match this format when input raw documents are single images (e.g. PNG, JPEG) or multi-page images (e.g. TIFF). This resulted in errors failing to build collated textract-ref + source-ref manifests for custom corpora including non-PDF documents.

Testing done:

Initially tested with synthetic corpus - exploring additional tests to verify the fix


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.