|
--- |
|
license: openrail |
|
--- |
|
|
|
|
|
<h3 align="center">PDF Document Layout Analysis</h3> |
|
<p align="center">Models for extracting segments alongside with their types from a PDF</p> |
|
|
|
In this model card, we are providing the non-visual models we use in our pdf-document-layout-analysis service: |
|
|
|
https://github.com/huridocs/pdf-document-layout-analysis |
|
|
|
This service allows for the segmentation and classification of different parts of PDF pages, identifying the elements such as texts, titles, pictures, tables and so on. Additionally, it determines the correct order of these identified elements. |
|
|
|
|
|
## Quick Start |
|
|
|
Clone the service: |
|
|
|
git clone https://github.com/huridocs/pdf-document-layout-analysis.git |
|
cd pdf-document-layout-analysis |
|
|
|
Start the service: |
|
|
|
# With GPU support: |
|
make start |
|
|
|
# Without GPU support [if you do not have a GPU on your system] |
|
make start_no_gpu |
|
|
|
|
|
Get the segments of a PDF: |
|
|
|
# With visual models |
|
curl -X POST -F 'file=@/PATH/TO/PDF/pdf_name.pdf' localhost:5060 |
|
|
|
# With non-visual models [with the models in this model card] |
|
curl -X POST -F 'file=@/PATH/TO/PDF/pdf_name.pdf' localhost:5060/fast |
|
|
|
|
|
When the process is done, the output will include a list of SegmentBox elements and, every SegmentBox element will has this information: |
|
|
|
{ |
|
"left": Left position of the segment |
|
"top": Top position of the segment |
|
"width": Width of the segment |
|
"height": Height of the segment |
|
"page_number": Page number which the segment belongs to |
|
"text": Text inside the segment |
|
"type": Type of the segment |
|
} |
|
|
|
|
|
To stop the server: |
|
|
|
make stop |
|
|
|
|
|
For more information, you can refer to: |
|
|
|
https://github.com/huridocs/pdf-document-layout-analysis |
|
|