Need help with layout-parser?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

176 Stars 32 Forks Apache License 2.0 124 Commits 2 Opened issues


A Python Library for Document Layout Understanding

Services available


Need anything else?

Contributors list

Layout Parser Logo

Docs PyPI PyVersion License

Layout Parser is a deep learning based tool for document image layout analysis tasks.


Use pip or conda to install the library: ```bash pip install layoutparser

Install Detectron2 for using DL Layout Detection Model

Please make sure the PyTorch version is compatible with

the installed Detectron2 version.

pip install 'git+'

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.

Quick Start

We provide a series of examples for to help you start using the layout parser library:

  1. Table OCR and Results Parsing:

    can be used for conveniently OCR documents and convert the output in to structured data.
  2. Deep Layout Parsing Example: With the help of Deep Learning,

    supports the analysis very complex documents and processing of the hierarchical structure in the layouts.

DL Assisted Layout Prediction Example

Example Usage

The images shown in the figure above are: a screenshot of this paper, an image from the PRIMA Layout Analysis Dataset, a screenshot of the WSJ website, and an image from the HJDataset.

With only 4 lines of code in

, 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, or load the model that you trained on your own. And use the following code to predict the layout as well as visualize it:
>>> import layoutparser as lp
>>> model = lp.Detectron2LayoutModel('lp://PrimaLayout/mask_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,) # With extra configurations


If you find

helpful to your work, please consider citing our tool using the following BibTeX entry.
  author = {Zejiang Shen and Ruochen Zhang and Melissa Dell},
  title = {LayoutParser},
  howpublished = {\url{}},
  year = {2020}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.