8000 GitHub - Moskize91/doc-page-extractor
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Moskize91/doc-page-extractor

Repository files navigation

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 >

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0