Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

doc-page-extractor-test-0.1.5.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

doc_page_extractor_test-0.1.5-py3-none-any.whl (74.3 kB view details)

Uploaded Python 3

File details

Details for the file doc-page-extractor-test-0.1.5.tar.gz.

File metadata

  • Download URL: doc-page-extractor-test-0.1.5.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for doc-page-extractor-test-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0f46fa232ea4036f6f1b0eb0b303ed23d009b089bac07a9c449aa756025dd9d9
MD5 433daa4643dd87682c54dc4a4e00c686
BLAKE2b-256 74b6e471ca2bf4ac4bb2413cdbb8cc729288abecfc317f27c6e2a05890a99e80

See more details on using hashes here.

File details

Details for the file doc_page_extractor_test-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for doc_page_extractor_test-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2e1a248871dac6c20b35aa32a42bc7eb7beef0d8ff7132b60c9a27d11f558848
MD5 13770217ebc7eb99f3975e9897b8b259
BLAKE2b-256 19f18105a719b0f688e7f93a9fc5c631973806551359ac55d0f56a613d352ac4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page