Skip to main content

An OCR library for Python

Project description

LanyOCR

A general OCR to detect and recognize English texts in an image based on a combination of EasyOCR and PaddleOCR.

LanyOCR automatically merges text boxes into lines even for rotated texts.

alt text

alt text

Getting Started

Install dependencies

pip install -r requirements.txt

Run example

PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --image_path images/example1.jpg

Faster version, a bit less accurate

PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --merge_boxes_inference true --image_path images/example1.jpg

Switch to different recognizer

PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --recognizer_name paddleocr_en_mobile --image_path images/example1.jpg

Recognize other languages

PYTHONPATH=. python detect.py --merge_rotated_boxes true --merge_vertical true --recognizer_name paddleocr_french_mobile --image_path images/french_example1.jpg

Output image will be in outputs/output.jpg

Supported Languages

  • English: paddleocr_en_server, paddleocr_en_mobile
  • French: paddleocr_french_mobile
  • Latin: paddleocr_latin_mobile

Note: Some unicode characters cannot be visualized correctly by OpenCV, please find the text lines in the console log.

Validate accuracy

Download ICDAR 2015 dataset

bash datasets/download_icdar2015.sh

Validate accuracy

python benchmark.py

Online API

You can try LanyOCR free on RapidAPI

To Do

[x] Abstract Class/Interface for each component
    [x] LanyOcrDetector: outputs locations of text boxes        
    [x] LanyOcrMerger: merge text boxes into text lines
    [x] LanyOcrRecognizer: convert text boxes/lines into text
    [x] LanyOcrAngleClassifier: estimate the angle of a text box/line

[ ] Multi-languages support
    [X] French        
    [X] Latin
    [ ] German

[ ] Inference using multi-models to improve accuracy
    [ ] Add interface to support voting policy

[ ] Expose flags to configure each component in OCR pipeline

Known issues

[ ] Visualization step: some small texts are drawn in incorrect directions

License

This project is licensed under the MIT License.

Credits

Special thanks to authors and developers of EasyOCR and PaddleOCR projects.

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

lanyocr-0.1.2.tar.gz (52.1 kB view details)

Uploaded Source

Built Distribution

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

lanyocr-0.1.2-py3-none-any.whl (86.4 kB view details)

Uploaded Python 3

File details

Details for the file lanyocr-0.1.2.tar.gz.

File metadata

  • Download URL: lanyocr-0.1.2.tar.gz
  • Upload date:
  • Size: 52.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for lanyocr-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9b765bf0365b1c1857001d7b0194954124a7c44d6ae308270c09110d35fc1a4e
MD5 4ba8a0745b8a29c3a364e7636e10d325
BLAKE2b-256 9b53c452dc1d1f409506860ba4637ea6a06bc7bdc3a0f465f1f21fff7e290ff5

See more details on using hashes here.

File details

Details for the file lanyocr-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: lanyocr-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 86.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for lanyocr-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae5243b8859fc0d683e3a3fd5941b8769baef5229b4fe0d9795a58c1d94c434a
MD5 6de5ab2d5c5b27b906e102dd1dd75f72
BLAKE2b-256 4121d694c550510699ab1b74a79ca6fcc35d46fbd239072c52cb43528e915c24

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