Layout Parser is a deep learning assisted tool for Document Image Layout Analysis.
Project description
Layout Parser is deep learning based tool for document image layout analysis tasks.
Installation
Use pip or conda to install the library:
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.
Quick Start
We provide a series of examples for to help you start using the layout parser library:
-
Table OCR and Results Parsing:
layoutparser
can be used for conveniently OCR documents and convert the output in to structured data. -
Deep Layout Parsing Example: 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 Example
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 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, 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
Citing layoutparser
If you find layoutparser
helpful to your work, please consider citing our tool using the following BibTeX entry.
@misc{shen2020layoutparser,
author = {Zejiang Shen and Ruochen Zhang and Melissa Dell},
title = {LayoutParser},
howpublished = {\url{https://github.com/Layout-Parser/layout-parser}},
year = {2020}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file layoutparser-0.1.1.tar.gz
.
File metadata
- Download URL: layoutparser-0.1.1.tar.gz
- Upload date:
- Size: 19.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ebf9a21c5a1e6e36056297dc18fbe520f67d4e47407d99194fda62d9dbcf3f7 |
|
MD5 | 7844a493c66b09b29730a8c39cc77d46 |
|
BLAKE2b-256 | 0e8effbcf437ccead72f09464845b3514e3c90e1921b87af35d070ffbf5a2fbf |
File details
Details for the file layoutparser-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: layoutparser-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfac10958c69b791d4a85800c8d5e409c31195ad8e9270af0f158e54d45adc32 |
|
MD5 | 1b70c910fd221872156094fe47301d97 |
|
BLAKE2b-256 | c163cc5678379c12d9eb1ee633e62af19d244e39dabc35ee68af6b4960bf7326 |