Skip to content

Conversation

@qued
Copy link
Contributor

@qued qued commented Jan 11, 2023

Adds ability to process images as single page documents. Uses mostly the same path as processing a pdf, but uses a null layout (since an image won't provide a pdf layout) and does not filter layout text blocks using a bounding box to discover text (because there are no layout text blocks).

Testing:

Run this code in the unstructured-inference environment:

from unstructured_inference.inference.layout import DocumentLayout

doc = DocumentLayout.from_image_file('sample-docs/loremipsum.png')
print(doc.pages[0].elements)

@qued qued requested a review from MthwRobinson January 11, 2023 04:42
Copy link
Contributor

@MthwRobinson MthwRobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Longer term, curious if there are cases where it may make sense to go straight to PaddleOCR instead to save on compute time. This looks great for the detectron2 case.

@qued qued merged commit b8238fe into main Jan 11, 2023
@qued qued deleted the feat/process-images branch January 11, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants