Skip to main content

a python package for openocr, which is used to help developers quickly deploy OCR algorithms implemented in the openocr framework.

Project description

OpenOCR: a general OCR system with accuracy and efficiency

Quick Start

Dependencies:

  • PyTorch version >= 1.13.0
  • Python version >= 3.7
conda create -n openocr python==3.8
conda activate openocr
conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=11.8 -c pytorch -c nvidia

After installing dependencies, the following two installation methods are available. Either one can be chosen.

1. Python Modules

pip install openocr-python

Usage:

from openocr import OpenOCR

engine = OpenOCR()

img_path = '/path/img_path or /path/img_file'
result, elapse = engine(img_path)

# Server mode
# engine = OpenOCR(mode='server')

2. Clone this repository:

git clone https://github.com/Topdu/OpenOCR.git
cd OpenOCR
pip install -r requirements.txt
wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/openocr_det_repvit_ch.pth
wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/openocr_repsvtr_ch.pth
# Rec Server model
# wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/openocr_svtrv2_ch.pth

Usage:

# OpenOCR system: Det + Rec model
python tools/infer_e2e.py --img_path=/path/img_fold or /path/img_file

# Det model
python tools/infer_det.py --c ./configs/det/dbnet/repvit_db.yml --o Global.infer_img=/path/img_fold or /path/img_file

# Rec model
python tools/infer_rec.py --c ./configs/rec/svtrv2/repsvtr_ch.yml --o Global.infer_img=/path/img_fold or /path/img_file

Demo

pip install gradio==4.20.0
wget https://github.com/Topdu/OpenOCR/releases/download/develop0.0.1/OCR_e2e_img.tar
tar xf OCR_e2e_img.tar
# start demo
python demo_gradio.py

More detail in OpenOCR Documentation

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

openocr_python-0.0.3-py3-none-any.whl (529.6 kB view details)

Uploaded Python 3

File details

Details for the file openocr_python-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for openocr_python-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8687644422002f2a7d666ba7a4f97924d49597144200aa6fb60a3fda6f59a16e
MD5 13fe0cccd1e217f2486b393d5805d3dc
BLAKE2b-256 796d4b2c10cef4114b44c62a1d2db911a2c6ecf1a573ade7bc0dd99cb1c30656

See more details on using hashes here.

Supported by

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