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.2.1.tar.gz (62.3 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.2.1-py3-none-any.whl (132.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: doc-page-extractor-test-0.2.1.tar.gz
  • Upload date:
  • Size: 62.3 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.2.1.tar.gz
Algorithm Hash digest
SHA256 b182922d4280c159f4dafb8263d97136e44f1d183b3a31d0d4e8c7db793ae144
MD5 57078e991f67cd8f910e998ba9213c54
BLAKE2b-256 16c23edf3950a1c16be53555ec7346b4fd20641568fe4576e4dda150e10f860d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for doc_page_extractor_test-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31254b7c60ac1e09a8e81defe6e0a6f3386f21068cc3ee2691ca1b6887c06d29
MD5 3f8d84578a3d0cb042abb68f261c97f1
BLAKE2b-256 1e939a1084281695451487ec6860b6fda89fb7d4939ca13658a69e5b3a045a3e

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