File size: 1,809 Bytes
2aa7f88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7aa0e84
2aa7f88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
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