# layout-parser **Repository Path**: germey/layout-parser ## Basic Information - **Project Name**: layout-parser - **Description**: A Python Library for Document Layout Understanding - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-18 - **Last Updated**: 2021-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
[](https://layout-parser.readthedocs.io/en/latest/) [](https://pypi.org/project/layoutparser/) [](https://pypi.org/project/layoutparser/) [](https://github.com/Layout-Parser/layout-parser/blob/master/LICENSE)
--- Layout Parser is deep learning based tool for document image layout analysis tasks. ## Installation Use pip or conda to install the library: ```bash pip install layoutparser # Install Detectron2 for using DL Layout Detection Model pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.1.3#egg=detectron2' # Install the ocr components when necessary pip install layoutparser[ocr] ``` This by default will install the CPU version of the Detectron2, and it should be able to run on most of the computers. But if you have a GPU, you can consider the GPU version of the Detectron2, referring to the [official instructions](https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md). ## Quick Start We provide a series of examples for to help you start using the layout parser library: 1. [Table OCR and Results Parsing](https://github.com/Layout-Parser/layout-parser/blob/master/examples/OCR%20Tables%20and%20Parse%20the%20Output.ipynb): `layoutparser` can be used for conveniently OCR documents and convert the output in to structured data. 2. [Deep Layout Parsing Example](https://github.com/Layout-Parser/layout-parser/blob/master/examples/Deep%20Layout%20Parsing.ipynb): With the help of Deep Learning, `layoutparser` supports the analysis very complex documents and processing of the hierarchical structure in the layouts. ## DL Assisted Layout Prediction With only 4 lines of code in `layoutparse`, you can unlock the information from complex documents that existing tools could not provide. You can either choose a deep learning model from the [ModelZoo](https://github.com/Layout-Parser/layout-parser/blob/master/docs/notes/modelzoo.md), or load the model that you trained on your own. And use the following code to predict the layout as well as visualize it: ```python >>> import layoutparser as lp >>> model = lp.Detectron2LayoutModel('lp://HJDataset/faster_rcnn_R_50_FPN_3x/config') >>> layout = model.detect(image) # You need to load the image somewhere else, e.g., image = cv2.imread(...) >>> lp.draw_box(image, layout, box_width=3) ```