Image/graph Extraction Pipeline #280
Replies: 3 comments 1 reply
-
You are looking for an extraction pipeline that detects images (with/without text content), crops and returns all images per page, right? I haven't worked through this use-case but I think this can be configured by changing only the Let me think about this, I'll try to work this out. |
Beta Was this translation helpful? Give feedback.
-
@JaMe76, hey, any luck on solving this use-case of extracting images?? Do update me if in case something comes out. Thanks again for considering this request |
Beta Was this translation helpful? Give feedback.
-
Sorry for late reply. Converting the issue into a discussion as this solution might be interesting to others as well. I've added some functions to make it easy to extract figures without diving deep into the extraction process. Everything depends, however, on the accuracy of the layout detection model. import deepdoctection as dd
path = "/path/to/dir/2312.13560.pdf" # you can find the sample here: https://github.com/deepdoctection/notebooks/blob/main/sample/2312.13560.pdf
analyzer = dd.get_dd_analyzer()
df = analyzer.analyze(path=path)
df.reset_state()
for dp in df:
figures = dp.get_annotation(category_names=dd.LayoutType.figure)
for fig in figures:
fig.viz(interactive=True) # vizualize the figure with an interactive window
np_array = fig.viz() # get the numpy array of the figure region
dd.viz_handler.write_image(f"/path/to/dir/{fig.annotation_id}.png", np_array) # save the numpy array as .png |
Beta Was this translation helpful? Give feedback.
-
Enhancement 🚀
The feature is simply an image extraction pipeline.
Motivation 💪
I believe any documents at times may include images just like they have tables and other data. so a clean extraction of it would be nice.
Currently I used the ImageLyaoutService which does crop the image but it works for tables. Can we possibly add a feature to extract figures and graphs?
Beta Was this translation helpful? Give feedback.
All reactions