doc page extractor can identify text and format in images and return structured data.
Project description
doc page extractor
English | 中文
Introduction
doc page extractor can identify text and format in images and return structured data.
Installation
pip install doc-page-extractor
pip install onnxruntime==1.21.0
Using CUDA
Please refer to the introduction of PyTorch and select the appropriate command to install according to your operating system.
In addition, replace the command to install onnxruntime in the previous article with the following:
pip install onnxruntime-gpu==1.21.0
Example
from PIL import Image
from doc_page_extractor import DocExtractor
extractor = DocExtractor(
model_dir_path=model_path, # Folder address where AI model is downloaded and installed
device="cpu", # If you want to use CUDA, please change to device="cuda".
)
with Image.open("/path/to/your/image.png") as image:
result = extractor.extract(
image=image,
lang="ch", # Language of image text
)
for layout in result.layouts:
for fragment in layout.fragments:
print(fragment.rect, fragment.text)
Acknowledgements
The code of doc_page_extractor/onnxocr in this repo comes from OnnxOCR.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file doc-page-extractor-test-0.1.6.tar.gz.
File metadata
- Download URL: doc-page-extractor-test-0.1.6.tar.gz
- Upload date:
- Size: 62.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39f322e5342bd27160c5031ef0b53587ef8bdd7b91012939885b0491f603c7d1
|
|
| MD5 |
d501d783d35cd789423851dda3583ab4
|
|
| BLAKE2b-256 |
b4d5a3ef360b351d0d88d188a14709e403c33d8000ed88e0fb14df7b6a64cbfc
|
File details
Details for the file doc_page_extractor_test-0.1.6-py3-none-any.whl.
File metadata
- Download URL: doc_page_extractor_test-0.1.6-py3-none-any.whl
- Upload date:
- Size: 74.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06a1eacc8ac455900920621d0fd9847af6d71df65c44acd5ef3137de8484ff39
|
|
| MD5 |
37e55b4e07305393769b455806098924
|
|
| BLAKE2b-256 |
6d6754ebdceeb7ef766d263e57ccb433453be84636c8e73d3223f099fe593b3c
|